File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes raw xml as the payload Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "raw xml as the payload" Watch "raw xml as the payload" New topic

raw xml as the payload

graham king
Ranch Hand

Joined: Dec 30, 2004
Posts: 133
Is it possible to send raw xml as the parameter for a web service call?

I have a web-service that I'm trying to consume which gives me errors each time I attempt to call it. The service is implemented using Microsoft Soap Toolkit 3.0 and the call has been proven to work using the following VB script:

However, when I try and access this service using axis-1.4 and sending the request as raw xml I get a 500 Internal Server Error.

The request looks like this:

It sends the html values for the < and >.

Which obviously doesn't work... Is it possible to send a request like this?

Or should the web service be parameterized?

[ November 01, 2007: Message edited by: graham king ]

write, revise, re-write, revise, again...<br />write, revise, re-write, revise, again...
Peer Reynders

Joined: Aug 19, 2005
Posts: 2933
Use Apache TCPMon to intercept the request issued and response received by the VB script. That will give you a better base for comparison.

Is there a particular reason why you aren't using WSDL2Java on ALMVTC.WSDL so that Axis can generate the Java stubs?

If it still doesn't come out right there may be ways to tweak the WSDL for Axis.

Other than that Axis seems to deal with raw XML only in the Message services style.
Peer Reynders

Joined: Aug 19, 2005
Posts: 2933
I could not even get your VBscript to work. It failed with the following message:

initialization failed WSDLOperation:
The operation getCandidateScheduleData is defined with encoded-style but has no encoding attribute
HRESULT=0x80004005: Unspecified error - WSDLOperation:Initializing of the input message failed for operation getCandidateScheduleData
HRESULT=0x80004005: Unspecified error - WSDLPort:An operation for port ScheduleSoapPort could not be initialized
HRESULT=0x80004005: Unspecified error - WSDLPort:Analyzing the binding information for port ScheduleSoapPort failed
HRESULT=0x80004005: Unspecified error - WSDLService:Initialization of the port for service ALMVTC failed
HRESULT=0x80004005: Unspecified error - WSDLReader:Analyzing the WSDL file failed
HRESULT=0x80004005: Unspecified error - Client ne of the parameters supplied is invalid.
HRESULT=0x80070057: The parameter is incorrect.

After I added a


in the right place it started to work.

This is the request that the VBscript/MS Soap Toolkit 3.0 sent:

As you can see even this request doesn't have the string as literal XML either - so that can't be the problem. The most glaring difference between this request and the one that your axis code generated is the lack of the SOAP-ENV:encodingStyle="" attribute in the Axis request.

If you have a close look at the WSDL that you supplied you should notice something peculiar. The WSDL specifies a "rpc/encoded" style binding for the getCandidateScheduleData operation input binding but then it specifies a "rpc/literal" style binding for the getCandidateScheduleData operation output binding!!!

Every SOAP web service I have ever run across used the same style on both the input and output! This must have confused Axis and it fell back onto "rpc/literal" when the actual web service was expecting "rpc/encoded". Once you tweak the WSDL to list both input and output as "encoded" Axis creates the correct request. Here is the relevant WSDL segment:

Axis Client Code:

Resulting request from Axis client code:

Note however the difference in the location of the encodingStyle attribute. The MS SOAP3 places it inside the SOAP body element. Axis on the other hand places it inside the getCandidateScheduleData element. According to the SOAP 1.1 Note this should not matter � but who knows.
I agree. Here's the link:
subject: raw xml as the payload
It's not a secret anymore!