You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsif-user@ws.apache.org by Rh...@sybase.com on 2004/02/27 18:46:12 UTC
AXIS 1.0 vs. 1.1 SOAP Header support
I am targetting the www.whitemesa.net site for interop testing of SOAP
Headers. With ApacheAXIS 1.0, I can sucessfully send and receive soap
headers; however, with ApacheAXIS 1.1, the soap response contains no
header. I have tracked this to AXIS requiring a namespace URI in
org.apache.axis.message.SOAPHeaderElement.java as follows:
public SOAPHeaderElement(Element elem)
{
super(elem);
// FIXME : This needs to come from someplace reasonable, perhaps
// TLS (SOAPConstants.getCurrentVersion() ?)
SOAPConstants soapConstants = SOAPConstants.SOAP11_CONSTANTS;
if (getNamespaceURI()
.equals(SOAPConstants.SOAP12_CONSTANTS.getEnvelopeURI()))
soapConstants = SOAPConstants.SOAP12_CONSTANTS;
...
}
i.e, if the List (using WSIF's ApacheAXIS provider) that is built up to set
the context of the WSIFMessage contains an org.w3c.dom.Element that has no
namespaceURI associated with, a NullPointerException occurs during the
namespaceURI() call. If, however, I build the Element with
Document.createElementNS(...) thus adding a namespace, I receive no
response header with Axis 1.1. The basic reason for this is that the
message "hello world" is somehow disappearing with AXIS 1.1, although I
have verified that "hello world" is indeed contained in the Element.
Perhaps the namespace I chose, the targetNamespace of the WSDL doc, when
building the Element is incorrrect? I have a gut feel that this is an
ApacheAXIS 1.1 problem and not WSIF, but wanted to provide a complete
picture.
Any ideas?
AXIS 1.0 SOAP request/response...
POST /interop/std/echohdr HTTP/1.0 Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.0 Host: localhost:8090 Cache-Control: no-cache Pragma:
no-cache SOAPAction: "http://soapinterop.org/" Content-Length: 619 <?xml
version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header><h:echoMeStringRequest
xmlns:h="http://soapinterop.org/echoheader/">hello
world</h:echoMeStringRequest> </soapenv:Header>
<soapenv:Body>
<ns1:echoString
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://soapinterop.org/">
<ns1:inputString xsi:type="xsd:string">inputString</ns1:inputString>
</ns1:echoString>
</soapenv:Body>
</soapenv:Envelope>
HTTP/1.0 200 OK Date: Fri, 27 Feb 2004 17:11:43 GMT Server: WhiteMesa SOAP
Server/3.2 Content-Type: text/xml; charset="utf-8" Content-Length: 548
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header><h:echoMeStringResponse
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:h="http://soapinterop.org/echoheader/">hello
world</h:echoMeStringResponse></SOAP-ENV:Header><SOAP-ENV:Body><m:echoStringResponse
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:m="http://soapinterop.org/"><return>inputString</return></m:echoStringResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
AXIS 1.1 SOAP request/response...
POST /interop/std/echohdr HTTP/1.0 Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.1 Host: localhost:8090 Cache-Control: no-cache Pragma:
no-cache SOAPAction: "http://soapinterop.org/" Content-Length: 578 <?xml
version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header><ns1:echoMeStringRequest xmlns:ns1="
http://soapinterop.org/"/> </soapenv:Header>
<soapenv:Body>
<ns2:echoString soapenv:encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="
http://soapinterop.org/">
<ns2:inputString
xsi:type="xsd:string">inputString</ns2:inputString>
</ns2:echoString>
</soapenv:Body>
</soapenv:Envelope>
HTTP/1.0 200 OK Date: Fri, 27 Feb 2004 15:35:34 GMT Server: WhiteMesa SOAP
Server/3.2 Content-Type: text/xml; charset="utf-8" Content-Length: 341
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="
http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<m:echoStringResponse SOAP-ENV:encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/" xmlns:m="http://soapinterop.org/
">
<return>inputString</return>
</m:echoStringResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The code <incomplete here> used to build the Element is as follows:
----
ArrayList domList = new ArrayList();
// Get context information for this binding.
WSIFMessage context = null;
context = wsifOp.getContext();
// Builder DOM from XML and add it to our domList.
DocumentBuilder parser =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = parser.parse(new
InputSource(part.getContentReader()));
// Axis1.1
//Element elem =
document.createElementNS(getDefinition().getTargetNamespace(), headerName
);
// Axis1.0
Element elem = document.getDocumentElement();
domList.add(elem);
// Update the WSIF Operation's context.
context.setObjectPart( WSIFConstants.CONTEXT_REQUEST_SOAP_HEADERS,
domList );
wsifOp.setContext(context);
----