As an Integration consultant I come across scenarios where I have a complex WSDL at hand with deeply nested structures and multiple schema definitions like the one below for Business Partner Replication.

Working with WSDL’s is all good and cool until you come across a requirement where you have to extract the XSD out of the WSDL and work on that. There might be several reasons why you may need to extract the XSD out of the WSDL a few of them which I faced are below.

    • XSD needs to be shared with a third party as their system only accepts and works upon XSD’s.
    • WSDL contains too much information and as SAP CI is interfacing between the third party and SAP this information is either not needed at their end or needs to be abstracted.
    • You need to do a XML validation in SAP CI which only works on a XSD schema and does not accept a WSDL!
    • You need to edit the schema in a way to perform multimapping on it for example
      <Messages>
      <Message1>
      <WSDL’s Schema>
      </Message1>
      <Message2>
      <Schema2>
      </Message2>

 

In all of these cases working on a WSDL directly and updating it is a nightmare and so is trying to extract the schema’s manually. Sometimes the WSDL files are easily over 10000 lines which makes it impossible to do it manually without comiting any mistakes.

 

Also what if you want a schema without any namespace prefixes? Stripping all the declarations and namespaces  and also ensuring that you handle complexType definitions where the name is same for different complexType definitions s a task in itself.

For example look at the two complexType “Text” definitions below they both are taken from the same WSDL but different Schema’s

 <xsd:complexType name="Text">
    <xsd:sequence>
     <xsd:element name="BuyerTextElementID" minOccurs="0" type="TextElement"/>
     <xsd:element name="SupplierTextElementID" minOccurs="0" type="TextElement"/>
     <xsd:element name="TextElementLanguage" minOccurs="0" type="LanguageCode"/>
     <xsd:element name="TextElementText" minOccurs="0" type="TextElementText"/>
     <xsd:element name="TextElementTextFormat" minOccurs="0" type="TextElementTextFormat"/>
    </xsd:sequence>
    <xsd:attribute name="Type" type="TextType"/>
 </xsd:complexType>

And

<xsd:complexType name="Text">
    <xsd:annotation>
     <xsd:documentation xml:lang="EN">
      <ccts:RepresentationTerm>Text</ccts:RepresentationTerm>
     </xsd:documentation>
    </xsd:annotation>
    <xsd:simpleContent>
     <xsd:extension base="xsd:string">
      <xsd:attribute name="languageCode" type="LanguageCode"/>
     </xsd:extension>
    </xsd:simpleContent>
</xsd:complexType>

 

If you just copy paste all the schema nodes into a single file you will have conflicting namespace declarations, mirror duplicate types, and duplicate types with different definitions and whole lot of WSDL definitions to take care of. Working on a small WSDL is easy but when it comes to large WSDL’s  like the one’s from SAP its not an easy task.

 

Solution

I developed a solution for this very problem and have deployed it for free use on UtilityArena.

Let me demonstrate how easy it is to extract a XSD out of a complex WSDL or repair a broken WSDL(a WSDL without any schema prefixes like the ones from salesforce , these are not accepted as is by SAP CI).

 

Go to the link above and upload your WSDL or paste the WSDL content in the text area.

Click on Extract XSD and then you will have your extracted XSD ready for download.

 

And with just a few clicks you will have your XSD extracted from a WSDL in seconds.

 

Sara Sampaio

Sara Sampaio

Author Since: March 10, 2022

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x