We have succeeded in solving this problem: it was necessary to hand-edit the
generated Stub file
and disable the REST style access to web services:

addPropertyToOperationClient(_operationClient,org.apache.axis2.Constants.Configuration.ENABLE_REST,false);

This turned off the option which caused Axis2 to send the payload in the
HTTP header (which corresponds to the REST style) to the traditional mode,
in which the payload was sent in the request body in the XML form.


-- Robert Novotny


Robert Novotny wrote:
> 
> I have the same problem here. I think that the culprit is the
> 
> <http:binding verb="POST"/>
> 
> element in the WSDL. This binding forces the WSDL2Java to generate code
> that sends the application/x-www-form-urlencoded header. This corresponds
> to the REST style of web service invocation. However, I think that this
> REST approach does not support complex objects.
> 
> If you look on the
> org.apache.axis2.transport.http.XFormURLEncodedFormatter class, you'd see
> the the getBytes() method which converts the SOAP payload to the byte
> representation sent via wire:
> 
> ...
> OMElement omElement =
> messageContext.getEnvelope().getBody().getFirstElement();
> 
>         if (omElement != null) {
>             Iterator it = omElement.getChildElements();
>             String paraString = "";
> 
>             while (it.hasNext()) {
>                 OMElement ele1 = (OMElement) it.next();
>                 String parameter;
> 
>                 parameter = ele1.getLocalName() + "=" + ele1.getText();
>                 paraString = "".equals(paraString) ? parameter :
> (paraString + "&" + parameter);
>             }
> 
>             return paraString.getBytes();
>         }
> 
> ...
> 
> If your message looks like this:
> <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
>   <soapenv:Body>
>     <ns2:getCustomerFolder xmlns:ns2="http://www.example.org/nPVR/";>
>       <getCustomerFolderRequestBody>
>         <getCustomerFolderInput>
>           <customerSmartvisionID>1</customerSmartvisionID>
>           <folderName>myFolder</folderName>
>         </getCustomerFolderInput>
>       </getCustomerFolderRequestBody>
>     </ns2:getCustomerFolder>
>   </soapenv:Body>
> </soapenv:Envelope>
> the only child matched by iterator is the getCustomerFolder. Deeper
> children are simply ignored. This seems quite natural to me, since the
> REST style via POST supports only key=value parameters passed in the HTTP
> header.
> 
> 
> However, I have heard about a possibility to send the SOAP message via
> both methods: some parameters in the HTTP POST header and some parameters
> in the payload send via XML. Is it possible in Axis2?
> 
> The quick hack which remedies your situation can be editing of the stub
> file. Just change content type in the
>                 
> addPropertyToOperationClient(_operationClient,org.apache.axis2.Constants.Configuration.CONTENT_TYPE,"application/x-www-form-urlencoded");
> and                  
> addPropertyToOperationClient(_operationClient,org.apache.axis2.Constants.Configuration.MESSAGE_TYPE,"application/x-www-form-urlencoded");
> 
> "text/xml" as advised. However, this hack would perhaps break your WSDL
> contract.
> 
> Robert Novotny
> 
> Ajith Ranabahu wrote:
>> 
>> The part that I can see as the problem is the last one where the
>> request is written to the wire. I can't understand how
>> the content type became application/x-www-form-urlencoded (should have
>> been text/xml for soap1.1. Since I see the SOAPAction header I suppose
>> its 1.1). Is there any other configuration regarding the httpclient ?
>> (that may have changed its behavior)
>> 
>> Ajith
>> 
>> 
>> On Fri, May 30, 2008 at 8:01 AM, Aljen7 <[EMAIL PROTECTED]> wrote:
>>>
>>> I can see thanks to dubugging that  the soapEnvelope in request is
>>> constructed in Stub class correctly and it remains unchainged during
>>> axis2
>>> engine which ended in the correct request calling messageContext is OK
>>> (afaik). Then why is it changed (empty - no body) when it comes to
>>> server.
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Axis2-%28ADB%29-%3A-Problem-with-empty-RequestBody-tp17532435p17557256.html
>>> Sent from the Axis - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>> 
>> 
>> 
>> -- 
>> Ajith Ranabahu
>> 
>> Reading, after a certain age, diverts the mind too much from its
>> creative pursuits. Any man who reads too much and uses his own brain
>> too little falls into lazy habits of thinking - Albert Einstein
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Axis2-%28ADB%29-%3A-Problem-with-empty-RequestBody-tp17532435p17644016.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to