This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
While I was figuring out what goes wrong with the generated Axis2 client code (as described here) I grabbed the packet containing the soap message and tried to use that in a ajax call
but I got a HTTP 500 error back.
500 The endpoint reference (EPR) for the Operation not found is /axis2/services/SimpleService?%3C?xml%20version=%221.0%22%20encoding=%22UTF-8%22?%3E%3Csoapenv:Envelope%20xmlns:soapenv=%22http://schemas.xmlsoap.org/soap/envelope/%22%3E%3Csoapenv:Body%3E%3Cns1:concatRequest%20xmlns:ns1=%22http://ttdev.com/ss%22%3E%3Cs1%3E%3C/s1%3E%3Cs2%3E%3C/s2%3E%3C/ns1:concatRequest%3E%3C/soapenv:Body%3E%3C/soapenv:Envelope%3E and the WSA Action = null
Then I took the soap message the Web Service Explorer used (or seemed to use) but it also didn't work with that.
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope><soapenv:Body><q0:concatRequest><s1>12</s1><s2>2312341234</s2></q0:concatRequest></soapenv:Body></soapenv:Envelope>
You have provided detailed information to spot the problem!
You are missing the following two namespace declarations within soapenv:Envelope element of your SOAP message.
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Joined: Dec 20, 2010
Naren Chivukula wrote:You have provided detailed information to spot the problem!
But I missed to cross-link this thread in the previous. Thanks so far. I'll work on it tomorrow as I have to figure out, what's going on in the generated code. And because I'm still quite new to web services I'm very interested in how everything fits together and what's under the hood ;-)
Joined: Dec 20, 2010
Ok, after hours of wondering why my packet sniffing tool didn't catch up the tcp stream from eclipse I figured out what exactly the Web Service Explorer in eclipse sends to the server.
Changing some parameters in my ajax call changed the http code from the previous 500 to 501 which was good somehow. With that information I know that some headers must be missing. The monitored tcp stream looked like:
POST /axis2/services/SimpleService/ HTTP/1.1
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: IBM Web Services Explorer
Aha, the SOAPAction was missing and the contentType wasn't set to application/soap+xml (but application/xml should also work as soap is xml). I don't know what d1 and the latter 0 means, maybe there's something wrong with the encoding (in my packet sniffer). The corresponding symbols with these hex codes don't make any sense. But as the server is responding back correctly those symbols seem to have no impact.
I'll post the ajax call very soon for those who are interested in that.