13 Replies Latest reply on Dec 2, 2010 4:31 AM by Seb Duke

    SOAPClient: array is not sent to the webservice

    Simon Desbonnets Newbie

      Hi,
      I'm new in Jboss and I would like to use the soapAction to call a webService (in SugarCRM). I creates a map that I add in my esb-message. There is no problem for all parameters except one: an array of string.
      My array is sent empty to the webservice.

      Here is how I create my message:

      Message esbMessage = MessageFactory.getInstance().getMessage();
      HashMap map=new HashMap();
      map.put("get_entry_list.session", session);
      List<String> string= new ArrayList<String>();
      string.add("id");
      string.add("first_name");
      map.put("get_entry_list.select_fields", string);
      
      esbMessage.getBody().add(map);
      
      ServiceInvoker invoker = new ServiceInvoker("SugarCRM_ESB", "SugarCRM_GetEntryList");
      Message response = null;
      try {
       response= invoker.deliverSync(esbMessage, 3000);
      }catch(Exception ex) {
       ex.printStackTrace();
      }
      

      I also tried other way to put my array:
      map.put("get_entry_list.select_fields[0]", "id");
      map.put("get_entry_list.select_fields[0]", "first_name");
      or
      map.put("get_entry_list.select_fields", new String[]{"id","first_name"});
      


      A part of the soap message that is send to my webservice (thanks to the log file of Jboss!):
      <session xsi:type="xsd:string">4db486656b7c3604ad81b4422874bdbd</session>
      <select_fields soapenc:arrayType="xsd:string[]" xsi:type="sug:select_fields">
      


      The part that have should be sent to the webservice (generated and tried with the software SoapUI):
      <session xsi:type="xsd:string">4db486656b7c3604ad81b4422874bdbd</session>
      <select_fields q0:arrayType="xsd:string[2]" xsi:type="q0:Array">
       <string>first_name</string>
       <string>id</string>
       </select_fields>
      


      And finally my jboss-esb.xml file:
       <?xml version = "1.0" encoding = "UTF-8"?>
      <jbossesb
       xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd"
       parameterReloadSecs="5">
       <providers>
       <jms-provider name="JBossMQ" connection-factory="ConnectionFactory">
       <jms-bus busid="SugarCRMEsbChannel_GetEntryList">
       <jms-message-filter dest-type="QUEUE"
       dest-name="queue/SugarCRM_esb_GetEntryList" />
       </jms-bus>
       </jms-provider>
       </providers>
       <services>
       <service category="SugarCRM_ESB" name="SugarCRM_GetEntryList"
       description="Use the get_entry_list function of the SugarCRM WebService">
       <listeners>
       <jms-listener busidref="SugarCRMEsbChannel_GetEntryList" name="ESBListener_GetEntryList" />
       </listeners>
       <actions mep="RequestResponse">
       <action class="org.jboss.soa.esb.actions.soap.SOAPClient"
       name="soapui-client-action">
       <property name="wsdl" value="http://127.0.0.1/SugarCRM/soap.php?wsdl" />
       <property name="SOAPAction" value="get_entry_list" />
       <property name="responseAsOgnlMap" value="false" />
       </action>
       </actions>
       </service>
       </services>
      </jbossesb>
      


      There is never error message but my array is not sent...
      Maybe there is a link with the type "soapenc:arrayType" but I would like to know if what I did is right before thinking that there is a bug.

      Thanks in advance and sorry for my bad english!

      Simon


        • 1. Re: SOAPClient: array is not sent to the webservice
          Simon Desbonnets Newbie

          I forgot the wsdl file. Here is the same I'm using (provided by SugarCRM):

          http://demo.sugarcrm.com/sugarcrm/soap.php?wsdl

          • 2. Re: SOAPClient: array is not sent to the webservice
            Simon Desbonnets Newbie

            No idea?

            I read that soap encoding is not allowed by Jboss, now I think that this is where my problem comes from.

            But, in this case, How could I use JbossESB to invoke this webservice?

            • 3. Re: SOAPClient: array is not sent to the webservice
              Kevin Conner Master

              If you want to send me a test case showing the issue then I can take a look at it over the weekend.

              Kev

              • 4. Re: SOAPClient: array is not sent to the webservice
                Simon Desbonnets Newbie

                Thanks Kevin, I sent you an example of my problem.

                Today I tried to use wsconsume again and I decided to post the console log in this forum:

                D:\jbossesb-server-4.5.GA\bin>wsconsume -k http://127.0.0.1/SugarCRM/soap.php?wsdl
                JBossWS-Native stack deployed
                parsing WSDL...
                
                
                [WARNING] src-resolve: Cannot resolve the name 'SOAP-ENC:Array' to a(n) 'type definition' component.
                 line 39 of http://127.0.0.1/SugarCRM/soap.php?wsdl#types?schema1
                
                [ERROR] undefined simple or complex type 'SOAP-ENC:Array'
                 line 39 of http://127.0.0.1/SugarCRM/soap.php?wsdl
                
                [ERROR] undefined attribute 'SOAP-ENC:arrayType'
                 line 40 of http://127.0.0.1/SugarCRM/soap.php?wsdl
                
                [ERROR] undefined simple or complex type 'SOAP-ENC:Array'
                 line 52 of http://127.0.0.1/SugarCRM/soap.php?wsdl
                
                [ERROR] undefined attribute 'SOAP-ENC:arrayType'
                 line 53 of http://127.0.0.1/SugarCRM/soap.php?wsdl
                
                [ERROR] undefined simple or complex type 'SOAP-ENC:Array'
                 line 59 of http://127.0.0.1/SugarCRM/soap.php?wsdl
                
                (... many times this error ...)
                
                Failed to invoke WsImport
                java.lang.NullPointerException
                 at com.sun.tools.xjc.reader.internalizer.SCDBasedBindingSet.apply(SCDBasedBindingSet.java:237)
                 at com.sun.tools.xjc.ModelLoader.createXSOM(ModelLoader.java:518)
                 at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:232)
                 at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:85)
                 at com.sun.tools.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:120)
                 at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2173)
                 at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:173)
                 at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:119)
                 at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:148)
                 at org.jboss.ws.tools.jaxws.impl.SunRIConsumerImpl.consume(SunRIConsumerImpl.java:217)
                 at org.jboss.wsf.spi.tools.cmd.WSConsume.importServices(WSConsume.java:223)
                 at org.jboss.wsf.spi.tools.cmd.WSConsume.main(WSConsume.java:81)


                You can try to do it yourself with the demo wsdl file (see previous post).
                'Soapenc' seems to be the problem and I hope you will find something that allow me to use this webservice with jboss

                Thanks,
                Simon

                • 5. Re: SOAPClient: array is not sent to the webservice
                  Tom Fennelly Master

                  So you are saying that you tried to use wsconsume directly on the wsdl and you go these errors (i.e. ESB out of the equation)? Perhaps it's a SOAP version issue, or something like that.

                  • 6. Re: SOAPClient: array is not sent to the webservice
                    Simon Desbonnets Newbie

                    thank you for your reply,

                    Yes, I tried wsconsume directly on the wsdl and it seems indeed that the soap version of the wsdl is not supported by Jboss. But the goal of jboss esb is to bypass all this interoperability problems... I hope!

                    Does someone already used sugarcrm's webservices with Jboss ESB?

                    • 7. Re: SOAPClient: array is not sent to the webservice
                      Joakim Sandstroem Newbie

                      Just a long shot, but have You tried out the following:

                      map.put("get_entry_list.select_fields.string[0]", "id");
                      map.put("get_entry_list.select_fields.string[1]", "first_name");
                      


                      But I'm not sure that the current soapclient implementation does support this. The select_fields element is defined as follows in the wsdl:
                       <xsd:complexType name="select_fields">
                       <xsd:complexContent>
                       <xsd:restriction base="SOAP-ENC:Array">
                       <xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd:string[]" xmlns:wsdl1="http://schemas.xmlsoap.org/wsdl/"/>
                       </xsd:restriction>
                       </xsd:complexContent>
                       </xsd:complexType>
                      


                      • 8. Re: SOAPClient: array is not sent to the webservice
                        Simon Desbonnets Newbie

                        Thanks,

                        Yes, I already tried this code but the result is still the same in the soap message without warning in the log:

                        <select_fields soapenc:arrayType="xsd:string[]" xsi:type="sug:select_fields"/>


                        I am not expert at all in web services but this 'SOAP-ENC' seems to be something like a standard. That's why I think SugarCRM decided to use it within its webservices to be sure to be interoperable.

                        But I'm sure that someone is already using Sugar's WS with JbossESB that's why I keep confident ;-).

                        • 9. Re: SOAPClient: array is not sent to the webservice
                          Tom Fennelly Master

                          OK... sorry... I should have read this more clearly the first time. This may be related to an issue that we fixed only recently. How many elements are in your array? The issue I'm thinking of only relates to single element arrays. If you already haven't, can you try your case using an array that has multiple values.

                          • 10. Re: SOAPClient: array is not sent to the webservice
                            Simon Desbonnets Newbie

                            I read about this problem in the forum. I tried with one and many elements in the array but it doesn't work better!
                            (in my previous post, the example was with two elements "id" and "first_name").
                            Is this answer your question ?

                            • 11. Re: SOAPClient: array is not sent to the webservice
                              Simon Desbonnets Newbie

                              It seems that I'm not alone...

                              http://www.jboss.org/index.html?module=bb&op=viewtopic&t=151401

                              Maybe I post my topic at the wrong place.

                              I think that guys of the community should write a clear note about problems of jbossWS (ESB) and soap encoding.
                              Thanks in advance ;-)

                              • 12. Re: SOAPClient: array is not sent to the webservice
                                Seb Duke Newbie

                                I have the same issue.

                                 


                                Here is how I am creating my message:

                                 


                                        Map requestMap = new HashMap();
                                        requestMap.put("Description_1","Test Description");
                                        requestMap.put("ConfigDetails_2.item[0].name","Name");
                                        requestMap.put("ConfigDetails_2.item[0].value","Test Name");
                                        $m.getBody().add("esb-params",requestMap);

                                 

                                 

                                 

                                And in my jboss-esb.xml, the action defined is

                                 


                                                <action name="soapui-client-action"
                                                    class="org.jboss.soa.esb.actions.soap.SOAPClient">
                                                    <property name="wsdl" value="https://test.com:443/task/index.php?wsdl">
                                                        <http-client-property name="file" value="${jboss.server.home.dir}/conf/ssl/test.properties"/>
                                                    </property>                  
                                                    <property name="serviceName" value="TaskManagementService"/>
                                                    <property name="EndPointName" value="TaskManagementEndPointPort"/>
                                                    <property name="SOAPAction" value="CreateTask"/>
                                                    <property name="get-payload-location" value="esb-params" />
                                                </action>

                                 


                                This is the soap envelop message and we missed the ConfigDetails_2 in it.

                                 

                                '<soapenv:Envelope xmlns:net="http://com.test.Task/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
                                <soapenv:Header />
                                <soapenv:Body>
                                <net:ConfigDetails_2>
                                <!--Zero or more repetitions: - cloned-->

                                 

                                </net:ConfigDetails_2>
                                <net:Description_1>Test Description</net:Description_1>
                                </soapenv:Body>
                                </soapenv:Envelope>

                                 


                                This issue is happened after the jboss esb upgradation from version 4.5 to 4.9.

                                 


                                With the version 4.5, its working fine.

                                 


                                Is there any solution for this issue?

                                 


                                Thanks in Advance.