SOAP webservice with Array response

0
Hi Guys I'm trying consume a SOAP web service with a WDSL. The issues is when it comes to the Serialization of the Response. I can't find a way to bind it with my entity. For example the first record is: 511 | OFF/W 226 Here is what the request and response looks like in SoapUI: WSDL: link text Would very much appreciate any pointers or tips how to consume this kind of data with Mendix. Thanks. Ron
asked
8 answers
1

Hi Cillus

Thanks for your answer. Yes, I have read that in depth. Still not working the way its decribed. Seems I need an XSD file which I now have generated.

The XSD files I have tried are here: link text

Here a screenshot of Mendix Mapping: alt text

I have also checked out this with no success: https://world.mendix.com/display/refguide5/XML+Schema+Support

Appreciate futher help.

KR Ron

answered
0

Hi Ron,

You have to use mapping to 'map' the response of the webservice to your domain model. It's very easy in Mendix to manage this.

Here is a link to the documentation how you can do this in Mendix:

How To: Consume a web service

Good luck.

answered
0

Ron,

If you are able to import the wsdl then simply go to your module domain model and select the option web service/xml file. This is located at the top of the window for the domain model. The follow the wizard that comes up and select web service operation in as the first selection. The diced to either use the imported web service or create a new one, follow all the steps and your domain model will be generated, without the need for an xsd file. You do however need the xsd files that are referenced in the wsdl to import the service.

answered
0

Hi Erwin

Thanks for you suggestion. I have also tried that. It seems the WSDL only responds with a single String, no further attributes. This example should have two attributes (SalDoc.BoId and SalDoc.BoNumber). But the XSD from the webservice only allows me to select "String".

Thanks for your futher help.

KR Ron

alt text

answered
0

The problem is this is a 'generic' webservice that can respond in any number of columns and combined with values. This makes it a lot harder to map in Mendix. How would you know what Row to map to w hat attribute?

answered
0

Hi Pieter

The attribute is defined by the <name> Tag for each Column (red). Each records is then in the <a:string> Tag (green).

See here: alt text

Is there a way to map this generic web service? Or would I need to reformat the response with Java or someting?

Thanks KR

Ron

answered
0

Hi Erwin

Thanks. The original xsd are here: XSD Zip File

KR Ron

Edit:

A better example of the Entity would be this.

Request:

 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:gen="http://www.opacc.com/Opacc/ServiceBus/Interface/Ws/Generic" 
xmlns:ws="http://www.opacc.com/Opacc/ServiceBus/Interface/Ws" 
xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
   <soapenv:Header/>
   <soapenv:Body>
      <gen:FlatRequest>
         <!--Optional:-->
         <gen:PortId>Biz</gen:PortId>
         <!--Optional:-->
         <gen:OperationId>GetBo</gen:OperationId>
         <!--Optional:-->
         <gen:RequestContext>
            <!--Optional:-->
            <ws:Installation></ws:Installation>
            <!--Optional:-->
            <ws:InstallationVersion></ws:InstallationVersion>
            <!--Optional:-->
            <ws:Consumer></ws:Consumer>
            <!--Optional:-->
            <ws:ClientId>20</ws:ClientId>
            <!--Optional:-->
            <ws:UserId>151</ws:UserId>
            <!--Optional:-->
            <ws:Password>Password==</ws:Password>
            <!--Optional:-->
            <ws:Permission></ws:Permission>
            <!--Optional:-->
            <ws:DataLanguageId></ws:DataLanguageId>
            <!--Optional:-->
            <ws:UserInterfaceLanguageId></ws:UserInterfaceLanguageId>
         </gen:RequestContext>
         <!--Optional:-->
         <gen:RequestData>
            <!--Optional:-->
            <gen:Parameters>
               <!--Zero or more repetitions:-->
               <arr:string>Addr</arr:string>
               <arr:string>1</arr:string>
            <arr:string>f</arr:string>
            <arr:string>1</arr:string>
            <arr:string>10</arr:string>
            <arr:string></arr:string>
            <arr:string>Addr.CustBoId>0 and Addr.Firstname>''</arr:string>
            <arr:string>Addr.BoId, Addr.FirstName, Addr.LastName, Addr.Street</arr:string>
            </gen:Parameters>
         </gen:RequestData>
      </gen:FlatRequest>
   </soapenv:Body>
</soapenv:Envelope>

Response:

    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <FlatRequestResponse xmlns="http://www.opacc.com/Opacc/ServiceBus/Interface/Ws/Generic">
         <ResponseInfo xmlns:a="http://www.opacc.com/Opacc/ServiceBus/Interface/Ws" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
            <a:Successful>true</a:Successful>
            <a:MessageId>NoPrev</a:MessageId>
            <a:MlsMessageText/>
         </ResponseInfo>
         <ResponseData xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
            <RowCount>10</RowCount>
            <ColumnCount>4</ColumnCount>
            <Columns>
               <Column>
                  <Name>Addr.BoId</Name>
                  <Rows xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
                     <a:string>161</a:string>
                     <a:string>10102</a:string>
                     <a:string>10103</a:string>
                     <a:string>10106</a:string>
                     <a:string>10109</a:string>
                     <a:string>10112</a:string>
                     <a:string>10115</a:string>
                     <a:string>10116</a:string>
                     <a:string>10126</a:string>
                     <a:string>10127</a:string>
                  </Rows>
               </Column>
               <Column>
                  <Name>Addr.FirstName</Name>
                  <Rows xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
                     <a:string>Kahdir</a:string>
                     <a:string>Rahiner</a:string>
                     <a:string>Arnjold</a:string>
                     <a:string>Paukl</a:string>
                     <a:string>Sonija</a:string>
                     <a:string>Marcelo</a:string>
                     <a:string>Rolande</a:string>
                     <a:string>Rene</a:string>
                     <a:string>Peter</a:string>
                     <a:string>René</a:string>
                  </Rows>
               </Column>
               <Column>
                  <Name>Addr.LastName</Name>
                  <Rows xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
                     <a:string>Demirs</a:string>
                     <a:string>Novako</a:string>
                     <a:string>Bartessaghi</a:string>
                     <a:string>Wulshleger</a:string>
                     <a:string>Mitiyamle</a:string>
                     <a:string>Paholzer</a:string>
                     <a:string>Müller</a:string>
                     <a:string>Hasliger</a:string>
                     <a:string>Leimgber</a:string>
                     <a:string>Besch</a:string>
                  </Rows>
               </Column>
               <Column>
                  <Name>Addr.Street</Name>
                  <Rows xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
                     <a:string>Kernstrasse</a:string>
                     <a:string>Felsenaustrasse</a:string>
                     <a:string>Wildbachstrasse</a:string>
                     <a:string>Kornstrasse</a:string>
                     <a:string>Fuhrstrasse</a:string>
                     <a:string>Chrüzacher</a:string>
                     <a:string>Hofacherstrasse</a:string>
                     <a:string>Bachtelstrasse</a:string>
                     <a:string>Zunsstrasse</a:string>
                     <a:string>Sennhüttenstrasse</a:string>
                  </Rows>
               </Column>
            </Columns>
         </ResponseData>
      </FlatRequestResponse>
   </s:Body>
</s:Envelope>

The Entity would be:

Customers

  • Customer No (Addr.BoId)
  • First name (Addr.FirstName)
  • Last name (Addr.LastName)
  • Street (Addr.Street)
answered
0

Ron,

I have been playing around with the service and I must agree with Pieter. The mapping can be created and it's a question on how to deal with the data. In the example you get 4 columns each of which has 10 rows of data. As the data is imported in the same way that it's presented in the xml file the order for each array of string values is the same as in the xml. If the data in the xml file is neatly ordered so that row 1 of column 1 belongs to row 1 of column 2, etc. you could retrieve the data once you made the ws call and create lists of the column values, al list for number, first name, last name and street. With these lists you can create the entity containing the 4 attributes. Not a straight forward job but it seems that this is possible. However the response is generic so there is no way of knowing what you're getting back. Might be 4 columns in this case and in the next this might be 10. Then you could think about the names in the columns and if these are fixed use these to retrieve the needed information and not care about possible other columns that come with the request. Be aware that this is not a full proof method as you're expecting 4 columns for your entity attributes it might be that a response doesn't contain 1 or more of the needed columns. Hope this gives you some pointers on how to proceed.

answered