Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have a server which is using a SOAP technology. It contains of forms and e.t.c. Also I have an application which find and replace text in files (in XML files) and save changes in new file. So, I need to call my server using application and replace the text in XML form and save it in my PC.
Here is the link of the same program+source. The difference is that my program has one more button, which is using to call server. This is code's part of my version:
C#
private void button1_Click(object sender, EventArgs e)    
{                                                                                           Services.SAPUserInfo myObj = new MassFindAndReplace.Services.SAPUserInfo();        Services.Service s = new Services.Service(); 
            myObj = s.SAPgetUserInfoAll("2500036077");  }


Here is a part of XML:

HTML
<my:lg_code xmlns:my="#unknown">2500036077</my:lg_code>


For example, my program will find "2500036077" and will replace it to another string and will save the document in my pc. I added the web reference to my win form, and pasted the url of my intranet to it. So, now I am connected to server. But I don't understand how can I provide a data from server with my program?
I am a beginner in web services and C#, please help with this problem. Thank You.
Posted

1 solution

When you reference a web service you don't need to parse the XML, the objects will be created for you through the generated proxy/client class.

You will then have a .NET object that you can modify the values of.

If you want, you can then save it out as XML using XmlSerializer[^]. This is a good doc with lots of explanation and good examples.

With the object in hand, you can then just do property assignment instead of search and replace.

There really should be any need to parse/edit the XML directly (unless there's a requirement here you've not yet listed). SOAP isn't meant to be something used by humans.

Cheers.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900