Solved

SOAP .Net XML text file

Posted on 2014-01-21
6
997 Views
Last Modified: 2016-02-26
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
Comment
Question by:rwallacej
  • 4
  • 2
6 Comments
 

Author Comment

by:rwallacej
ID: 39798278
A better description might be how to "decode" to make a class with properties to match the XML
0
 

Author Comment

by:rwallacej
ID: 39798327
Or how to put the XML soap text into a "presentable" format as objects/vb classes for processing
0
 

Author Comment

by:rwallacej
ID: 39798396
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 12

Expert Comment

by:Jitendra Patil
ID: 39799529
0
 

Author Comment

by:rwallacej
ID: 39800863
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
 
LVL 12

Accepted Solution

by:
Jitendra Patil earned 500 total points
ID: 39802183
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Here I am going to explain creating proxies at runtime for WCF Service. So basically we use to generate proxies using Add Service Reference and then giving the Url of the WCF service then generate proxy files at client side. Ok, what if something ge…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now