on 11-05-2013 9:52 AM
Hi,
I have one .NET web service(deveoped by me) and I have asked my vendor to consume that using ABAP and as one of the parameters is declared as an array, he says it cannot be consumed.
Does any one has any idea on how to consume such a web service in SAP>
Thanks
Sri
In SAP, the consumer is generated from the WSDL. It creates proxy classes and types automatically, which are then used in the program. It is at least one level of abstraction away from constructing SOAP requests.
However, it is possible to process arrays/tables. I've written a service in SAP that is consumed using XML like this:
<TABLE_OF_DATA>
<item>
<field1>item of data</field1>
<field2>another item</field2>
</item>
<item>
<field1>more data</field1>
<field2>and more</field2>
</item>
</TABLE_OF_DATA>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Matthew,
Thanks for your quick reply. I am aware that SAP / ABAP generates the proxy classes but according to my friend they can only construct a table but not a complex(array) XML string.
My request is almost the same
<items>
<item1>
<itemno>
<itemname>
<itemdesc>
</item1>
<item2>
<itemno>
<itemname>
<itemdesc>
</item2>
</items>
May I know how can you construct this request?I would advise them accordingly.I dont know anything in ABAP but I am just posting here on his behalf
Thanks once again
Sri
The thing is - you supply them with a WSDL, they generate the proxy. And that's it.
The WSDL defines the type as:
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="5" />
<xsd:pattern value="\d*" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="9" />
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="SAP_STUFF">
<xsd:sequence>
<xsd:element name="FIELD1" type="tns:char9" />
<xsd:element name="FIELD2" type="tns:numeric5" />
</xsd:sequence>
</xsd:complexType>
- <xsd:sequence>
<xsd:element name="item" type="tns:SAP_STUFF" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
On the ABAP side, the type to fill this structure is automatically generated from the WSDL.
Hi Matthew,
That's how it should be and I believe that's how it is but they claim that if the input parameter is declared as string[] items in .net they say that it cannot be handled and the data at their side is stored in tables and they are not in a position to pass the whole table as string
Please advise
Thanks
Sri.
Simple
<xsd:simpleType name="numeric3">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="3" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="char255">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="255" />
<xsd:pattern value="\d*" />
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="BIT_OF_A_STRING">
<xsd:sequence>
<xsd:element name="LENGTH" type="tns:numeric3" />
<xsd:element name="FIELD2" type="tns:char255" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="TABLIZED_STRING">
<xsd:sequence>
<xsd:element name="item" type="tns:BIT_OF_A_STRING" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
Break your string up into pieces of max length of 255 (or whatever length you like). Build the pieces into a table, with each record holding the length of the piece and the piece itself.
So, if you had a max length of 10, then "this is the string to be transmitted" would be
10,"this is st"
10,"ring to be"
10," transmitt"
2, "ed"
At the other end, the ABAP developer has to reconstruct the table into a string.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.