sponsored links



No announcement yet.

Problem with arrays using the WSDL2Ws tool

  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with arrays using the WSDL2Ws tool


    I have created a Web Service client application that is going to send SOAP messages in a remote service running on a websphere server outside of the iSeries.
    To create this application, firstly, I used the WSDL2Ws tool in order to auto-generate the service “stub” methods (based on a provided .wsdl file).
    The stubs are written in RPG.
    After that, I coded an RPGle program (that uses the auto-generated code) in order to retrieve some data from the database and send them to the remote web service.

    Auto Generated code
    The remote web service has an operation that is called addCustomer.
    This operation requires as input the following “Customer_t” structure (as it is auto-generated by the WSDL2Ws tool):
    D Customer_t 		ds		qualified template
    D isNil_Customer_t  		1n
    D name					likeds(xsd_String)
    D contactDetails			likeds(contact_details_t)
    D addresses				likeds(address_Array_t)			
     *The above DS requires some other DSs (see below).
    D Contact_details_t 	ds		qualified template
    D isNil_contact_Details_t 	1n
    D phone				likeds(xsd_String)
    D email					likeds(xsd_String)
    D address_Array_t 	ds		qualified template
    D isNil_address_array_t	  	1n
    D array					likeds(address_t) dim(15)
    D size                          		10i 0  
    D type                          		10i 0  
    D address_t 		ds		qualified template
    D isNil_address_t	  	1n
    D city					likeds(xsd_String)
    D street                          			likeds(xsd_String)
    D number                          	 	likeds(xsd_long)

    my custom code
    In my RPG program, I populate the Customer_t variable (with name WsInput) as following:
    d WsStub          ds                  	likeds(This_t)       
    d WsInput         ds                  	likeds(Customer_t)                                                    
    d WsOutput      ds                	likeds(xsd_string)   
    c		Eval 	WsInput.name.value = ‘john doe’
    c		Eval 	WsInput.contactDetails.phone.value = ‘123456789’
    c		Eval 	WsInput.contactDetails.email.value = ‘test@test.com’
    c		Eval 	WsInput.addresses.array(1).city.value = ‘city1’
    c 		Eval 	WsInput.addresses.array(1).street.value = ‘street1’
    c		Eval	WsInput.addresses.array(1).number.value = 111
    c 		Eval 	WsInput.addresses.array(2).city.value = ‘city2’
    c		Eval 	WsInput.addresses.array(2).street.value = ‘street2’
    c		Eval 	WsInput.addresses.array(2).number.value = 222
    //After that I try to post the request like this:
    if stub_create_CustomerWS(WsStub);                                                                     
      	// Invoke the Web service operation.                          
     	if stub_op_addCustomer0(WsStub:WsInput:wsOutput);                                                                   		
                    outputText = wsOutput.value;                                                                                              
    		outputText = WsStub.excString;                             
      	// Destroy Web service stubs.                                 

    problem description
    My problem is that the XML message that is sent in the remote application (you can see below the message structure)
    contains all the values that are set in my program except for the address details.
    i guess that it is happening because the address details are defined as array, but I do not know how to fix it.

    Can anyone help me with that?

    Thank you in advance

    WSDL file (.xsd file actually)

    HTML Code:
    <xs:element name="addCustomer" type="tns:addCustomer"/>
    <xs:element name="addCustomerResponse" type="tns:addCustomerResponse"/>
    <xs:complexType name="addCustomer">
                     <xs:element name="customer" type="tns:customerDetails" minOccurs="0"/>
    <xs:complexType name="customerDetails">
    		<xs:element name="name" type="xs:string" minOccurs="0"/>
    		<xs:element name="contactDetails" type="tns:contactDetails" minOccurs="0"/>
    	        <xs:element name="addresses" type="tns:address" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
    <xs:complexType name="contactDetails">
    		<xs:element name="phone" type="xs:string" minOccurs="0"/>
    		<xs:element name="email" type="xs:string" minOccurs="0"/>
    <xs:complexType name="address">
    		<xs:element name="city" type="xs:string" minOccurs="0"/>
    		<xs:element name="street" type=" xs:string" minOccurs="0"/>
    		<xs:element name="number" type="xs:long" minOccurs="0"/>
    <xs:complexType name="addCustomerResponse">
    		<xs:element name="return" type="xs:string" minOccurs="0"/>

    //Xml message that arrives to websphere.

    HTML Code:
    <ns1:addCustomer xmlns:ns1="http://blablabla.com/">
    		<name>john doe</accountNo>

  • #2
    Re: Problem with arrays using the WSDL2Ws tool

    no answer?


    • #3

      I am facing the same error.

      Does anybody know if there is a general problem with transmitting arrays to a webservice using the wsdl2ws.sh tool?
      Everything works fine with data in a flat structure, but the arrays seem to get "lost" on the way to the webservice.
      Although there is no error at runtime.



      • #4
        It is IBM supplied tooling that comes with the OS - why not simply report the problem to IBM?


        • #5
          Are you setting the array size?
          WsInput.addresses.size = x (X - # of elements in the array)