We have a hosted application called Camstar. It provides SOAP webservices built around WCF.
I have a payload that work. I can invoke the web service from SoapUI using the payload below.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soapenv:Header>
<WSShopFloorHeader xmlns="http://www.camstar.com/WebService/WSShopFloor">
<UserName>abc</UserName>
<Password>def</Password>
</WSShopFloorHeader>
</soapenv:Header>
<soapenv:Body>
<Submit xmlns="http://www.camstar.com/WebService/WSShopFloor">
<serviceData xmlns:ns0="http://www.camstar.com/WebService/DataTypes" ns0:type="LotStart">
<Factory>
<__CDOTypeName/>
<__name>X30</__name>
</Factory>
<Comments/>
<Workflow>
<__name>TESTSTOREWF</__name>
<__rev/>
<__useROR>true</__useROR>
</Workflow>
<WorkflowStep>
<__CDOTypeName/>
<__name>DBINTSINVSPEC</__name>
</WorkflowStep>
<Qty>1000</Qty>
<Qty2>10</Qty2>
<Product>
<__CDOTypeName/>
<__name>9672-02-9450-D00.BW</__name>
<__rev/>
<__useROR>true</__useROR>
</Product>
<StartReason>
<__CDOTypeName/>
<__name>NORMAL</__name>
</StartReason>
<Owner>
<__CDOTypeName/>
<__name>PROD</__name>
</Owner>
<Level>
<__CDOTypeName/>
<__name>LOT</__name>
</Level>
<ContainerName>TEST004</ContainerName>
</serviceData>
</Submit>
</soapenv:Body>
</soapenv:Envelope>
I am unable to figure out how to create an XSD based on the above XML. The only namespaces are in the Submit and serviceData elements and they are inline.
Also how to create XSLT if I need to generate the name xml from one source to the other?
I will answer this question in two parts:
1) XSD for Soap XML:
Well. Sharing my personal experience.. we get SOAP XML from a third party! SOAP XMLs actually known as WSDL, have bunch of namespace and in our real-time business, these namespace change..
On the other hand if you treat it as an XML:
When you come across XML files that have different namespace for different nodes! I mean, namespace present for parent is not same as that of child nodes.. you would need to comeup with more than one XSD files linked with
<import>13ren has already posted an answer .. BUT!! This kind of validation doesn’t work with most of the XML parsers! I myself have experienced!I have observed it working in MS-visual studio, where multiple assignment of XSD works!.. Where as when you try to load XML and XSD using
XmlValidatingReaderin .Net this fails!! Same behavior with any other online validation tools ..And there is one more problem with this SOAP XML. They carry bunch of different Namespace, by this method we can’t keep on adding as many XSD files as number of Namespace!!
I have also tried .net code that tries to use XSD against Soap XML. here is the link
.. But I am afraid .. I couldn’t succeed well!
I give thumbs up to 13ren’s method, if you are validating XML manually!
2) XSLT for an XML:
XSLT is a functional programming language (not procedural). This is how you go with practicing XSLT:
A tutorial for your reference:
https://stackoverflow.com/questions/1858345/xsltwhich-is-the-best-tutorial-you-would-like-to-recommend