Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1208
  • Last Modified:

SOAP .Net XML text file

I have result of web service function in a XML text file. It cane from the guy who setup service
I can't connect to the service yet til I get permissions, so simple "add service" in visual studio does nothing

I'd like to have the XML as .vb classes etc., write code on it an so on, just like you can when using "add reference "

Can I do anything like this from XML file only? So simulate connect to service whilst waiting for it ?
0
rwallacej
Asked:
rwallacej
  • 4
  • 2
1 Solution
 
rwallacejAuthor Commented:
A better description might be how to "decode" to make a class with properties to match the XML
0
 
rwallacejAuthor Commented:
Or how to put the XML soap text into a "presentable" format as objects/vb classes for processing
0
 
rwallacejAuthor Commented:
example SOAP returned is as follows: note I have stripped this down, it mightn't be valid now

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <ns1:blahBlah soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="com.z">
         <abcd soapenc:arrayType="ns1:measValueWSVO[10]" xsi:type="soapenc:Array"
             xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
            <abcd href="#id0"/>
            <abcd href="#id1"/>
            <abcd href="#id2"/>
            <abcd href="#id3"/>
            <abcd href="#id4"/>
            <abcd href="#id5"/>
            <abcd href="#id6"/>
            <abcd href="#id7"/>
            <abcd href="#id8"/>
            <abcd href="#id9"/>
         </abcd>
      </ns1:blahBlah>
      <multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        xsi:type="ns2:measValueWSVO" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:ns2="com.z">
         <charvalue xsi:type="soapenc:string" xsi:nil="true"/>
         <errorNumber xsi:type="soapenc:string"/>
         <errorText xsi:type="soapenc:string"/>
         <ddd xsi:type="soapenc:string">aaa</ddd>
         <zzz xsi:type="soapenc:string">1007</zzz>
         <eee xsi:type="soapenc:string">Attribution</eee>
         <mID xsi:type="soapenc:string">zzzddd</mID>
         <jjj xsi:type="soapenc:string">aaavvv</jjj>
         <measurementType xsi:type="soapenc:string">GGG</measurementType>
         <numericValue xsi:type="soapenc:string">18.020000</numericValue>
         <objectDescription xsi:type="soapenc:string">jjj FFF</objectDescription>
         <objectId xsi:type="soapenc:string">1007</objectId>
         <objectName xsi:type="soapenc:string">jjj FFF</objectName>
         <scenario xsi:type="soapenc:string">PROVISIONAL</scenario>
         <timestamp xsi:type="soapenc:string">13/01/2014 06:00</timestamp>
         <units xsi:type="soapenc:string">kSm3</units>
      </multiRef>
      <multiRef id="id8" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns3:measValueWSVO" xmlns:ns3="com.z" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
         <charvalue xsi:type="soapenc:string" xsi:nil="true"/>
         <errorNumber xsi:type="soapenc:string"/>
         <errorText xsi:type="soapenc:string"/>
         <ddd xsi:type="soapenc:string">KKKK</ddd>
         <zzz xsi:type="soapenc:string">1007</zzz>
         <eee xsi:type="soapenc:string">FFF IIIKKK PJKL Attributed </eee>
         <mID xsi:type="soapenc:string">FBPpNGL_ATT_M_GD</mID>
         <jjj xsi:type="soapenc:string">FBPpNGL,Att,M IOII</jjj>
         <measurementType xsi:type="soapenc:string">NGL_MASS</measurementType>
         <numericValue xsi:type="soapenc:string">4.381075</numericValue>
         <objectDescription xsi:type="soapenc:string">jjj FFF</objectDescription>
         <objectId xsi:type="soapenc:string">1007</objectId>
         <objectName xsi:type="soapenc:string">jjj FFF</objectName>
         <scenario xsi:type="soapenc:string">PROVISIONAL</scenario>
         <timestamp xsi:type="soapenc:string">13/01/2014 06:00</timestamp>
         <units xsi:type="soapenc:string">tonne</units>
      </multiRef>
0
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
Jitendra PatilSr.Software EngineerCommented:
0
 
rwallacejAuthor Commented:
ok...I see
var bytes = Encoding.UTF8.GetBytes(theMessageString);
var reader = XmlDictionaryReader.CreateTextReader(bytes, XmlDictionaryReaderQuotas.Max);

what next, what do I do with the reader?
0
 
Jitendra PatilSr.Software EngineerCommented:
ok try the below way.

create a wsdl file of your xml SOAP response, please refer the below link for further information.
Web Services Description Language Tool

keep the wsdl file in C:\inetpub\wwwroot  folder, so that it will be up and running.

add a Web reference to your project and locate the service by the name you provide to your file.

add directive of the service and ready to go.

hope this helps.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now