简体   繁体   中英

Axis2 and WSDL2Java: SOAP header is missing

I've generated the java code from wsdl using WSDL2Java. I create a SOAP request and I send it to the server, which answers with an AxisFault. If I have a look in the soap request there is no header tag . Why not?

Does the follwing line in the stub not add a header?

// adding SOAP soap_headers
_serviceClient.addHeadersToEnvelope(env);

What would be the solution to add a header, so that the SOAP request looks like that:

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
   ...
   </soapenv:Body>
</soapenv:Envelope>

根据http://schemas.xmlsoap.org/soap/envelope/(SOAP V1.1),标头不需要是传出的soap请求的一部分:

<xs:element ref="tns:Header" minOccurs="0"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM