cxf - Mule SOAP client wrapper as parameter instead of object array -


i created sample mule flow first generating client classes cxf per http://www.mulesoft.org/documentation/display/current/consuming+web+services+with+cxf guide.

the flow started going localhost:8081/test. parametersobjectarray transform message hardcoded object array required web service method call, this:

package com.test.example.transformers;  import org.mule.api.transformer.transformerexception; import org.mule.transformer.abstracttransformer;  public class getcustomersarraytransformer extends abstracttransformer {      @override     protected object dotransform(object src, string enc)             throws transformerexception {         object[] msg = new object[3];         msg[0] = 10;         msg[1] = 0;         msg[2] = null;          return msg;     }     } 

when transformer used in flow pass message jaxws-client node, works expected:

<custom-transformer name="parametersobjectarray" class="com.test.example.transformers.getcustomersarraytransformer" doc:name="java"/>      <flow name="mulecartflow" doc:name="mulecartflow">     <http:inbound-endpoint exchange-pattern="one-way" host="localhost" port="8081" doc:name="http" path="test"/>     <transformer ref="parametersobjectarray" doc:name="java"></transformer>     <https:outbound-endpoint exchange-pattern="request-response" host="12.34.56.78" port="1234" path="services/soap/testendpoint" doc:name="http" connector-ref="httpsconnector" method="post">         <cxf:jaxws-client clientclass="com.test.testendpointservice" enablemulesoapheaders="true" doc:name="soap" operation="getcustomers" port="testendpoint" />     </https:outbound-endpoint>     <transformer ref="customerinfotypestostring" doc:name="transformer reference"/>     <logger level="info" doc:name="logger" message="#[message:payload]"/> </flow> 

i use wrapper object, parameters legible , type-safe:

package com.test.example.transformers;  import org.mule.api.transformer.transformerexception; import org.mule.transformer.abstracttransformer;  import com.test.getcustomers;  public class getcustomersobjecttransformer extends abstracttransformer {      @override     protected object dotransform(object src, string enc)             throws transformerexception {                    getcustomers soaprequest = new getcustomers();         soaprequest.setstartindex(0);         soaprequest.setmaxbatchsize(1);          return soaprequest;     }  } 

however, not seem work. noticed manual page states:

note: cxf transport doesn't support wrapper-style web service method calls. may need create binding file or change wsdl directly

what mean? how can send wrapper object wraps method parameters web service method?

add:

    <jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">         <jaxws:enablewrapperstyle>false</jaxws:enablewrapperstyle>     </jaxws:bindings> 

inside wsdl:porttype , cxf generate wrapper objects you're after.

also, note creating java transformer set payload overkill: use set-payload simple mel expression , you'll good.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -