[jboss-dev-forums] [JBoss ESB Development] - Is this the way to make a SOAP client, extract params and response ?

Igor JStarter do-not-reply at jboss.com
Thu Sep 16 07:05:13 EDT 2010


Igor JStarter [http://community.jboss.org/people/izgur] created the discussion

"Is this the way to make a SOAP client, extract params and response ?"

To view the discussion, visit: http://community.jboss.org/message/562139#562139

--------------------------------------------------------------
I'm just trying to understand how to write a SOAP client. If you can: PLEASE REPLY

Up to know, i think thats the way:

1. jboss-esb.xml with actions:request-mapper, response-mapper and a soap-wise-client-action

            <actions mep="OneWay">
                <action name="request-mapper" class="org.jboss.soa.esb.test_SOAPClient.testMyRequestAction">
                </action>
                <action name="soap-wise-client-action" class="org.jboss.soa.esb.actions.soap.wise.SOAPClient">
                    <property name="wsdl" value="http://172.18.112.81:8080/tst?WSDL" />
                    <property name="SOAPAction" value="retrieveCdrs"/>
                    <property name="EndPointName" value="CdrManagerWSImplPort"/>
                    <property name="SmooksRequestMapper" value="smooks-request-config.xml"/>
                    <property name="SmooksResponseMapper" value="smooks-response-config.xml"/>
                </action>
                <action name="response-mapper" class="org.jboss.soa.esb.test_SOAPClient.testResponseAction">
                </action>
            </actions>

2. define SmooksRequestMapper and SmooksResponseMapper XMLs

    <resource-config selector="org.jboss.soa.esb.SOAPClient.ExternalObject">
        <resource>org.milyn.javabean.BeanPopulator</resource>
        <param name="beanId">complexObject</param>
        <param name="beanClass">org.jboss.soa.esb.testSOAPClient.generated.ComplexObject</param>
        <param name="bindings">
            <binding property="stringField" selector="internal text" />
            <binding property="stringField" selector="internal text" />
            <binding property="stringField" selector="internal text" />
            <binding property="stringField" selector="internal text" />
            <binding property="stringField" selector="internal text" />
            <binding property="integerField" type="Integer" selector="internal number" />
        </param>
    </resource-config>

3. define InternalObject.class and ExternalObject.class


public class InternalObject implements Serializable {                 /**          *          */         private static final long serialVersionUID = -8341272228911883415L;                 private String text;         private Integer number;         public String getText() {return text;}         public void setText(String text) {this.text = text;}         public Integer getNumber() {return number;}         public void setNumber(Integer number) {this.number = number;}     }

InternalObject should have the same parameters as the ws request.
ExternalObject should have the same parameters as the ws response.

SmooksRequestMapper and SmooksResponseMapper XMLs must have bindings like the request/response parameters ...

What's up with the ComplexObject?

4. Write a test client with the void sendMessage

     ServiceInvoker deliveryAdapter = new ServiceInvoker(                 "TESTServiceCategory", "TEST_SOAPClient");         // Create and populate the request message...         Message requestMessage = MessageFactory.getInstance().getMessage(                 MessageType.JBOSS_XML);         ExternalObject external = new ExternalObject();         InternalObject internal = new InternalObject();         internal.setNumber(new Integer(1));         internal.setText(message);         external.setInternal(internal);         String dateString = "2007-03-07T04:27:00";         Date date = (new SimpleDateFormat(DEFAULT_DATE_FORMAT))                 .parse(dateString);         external.setDate(date);         requestMessage.getBody().add(external);         // Deliver the request message synchronously - timeout after 20         // seconds...         deliveryAdapter.deliverAsync(requestMessage);
I

s this everythink what i need to do to call an external ws ?

Can somebody explain

Thanks in advance!

BR, Igor!
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/562139#562139]

Start a new discussion in JBoss ESB Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2032]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20100916/d1d2314e/attachment.html 


More information about the jboss-dev-forums mailing list