473,508 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WebServices and Serialization

Im currently developing an API using a vb.net web service. Im very
nearly there as regard to functionality but would like to add a
feature so that users can see exactly what xml is being generated
(sent and received) for each API command.

Picture the scenario. I have a UI which contains the following...

Multiline text box: Friendly response from API (Displays results)
Multiline text box: XML Sent (would like to display xml sent)
Multiline text box: XML Received (would like to display xml received)

The API commands work fine and display the correct results in the
"Friendly response from API" box. Also, if I browse directly to the
Web Service I get a convinient screen showing all exposed commands
(web methods) as hyperlinks that the Web Service contains. If I click
on one of these hyperlinks I get another convinient screen showing
what the method expects to see from a posted SOAP message and a posted
HTTP POST and the responses the method will throw back.

What I would like to do is somehow serialse my API commands so that
when a user clicks an API command button the "XML Sent" and "XML
Received" boxes are automatically populated with what is sent \
recieved behind the scenes.

I think im close (but no cigar) at the moment. Im using the following
code to try and serialse the command \ data type but the response
being displayed in my "XML Received" text box does not match the auto
generated SOAP response which I discussed earlier. Think it may have
something to do with either name spaces or the way SOAP works? Any
ideas or pointers would be very much appriciated.

What my xml should look like...

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<IDP_DomainAvailabilityChecker_SingleResponse
xmlns="http://tempuri.org/Safenames_IDP_XML_API_WebService/Service1">
<IDP_DomainAvailabilityChecker_SingleResult>
<DomainName>string</DomainName>
<Success>boolean</Success>
<CommandName>string</CommandName>
<Description>string</Description>
</IDP_DomainAvailabilityChecker_SingleResult>
</IDP_DomainAvailabilityChecker_SingleResponse>
</soap:Body>
</soap:Envelope>

And what is displayed in my "XML Recived" text box...

<?xml version="1.0" encoding="utf-16"?>
<IDPResults xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DomainName xmlns="http://tempuri.org/Safenames_IDP_XML_API_WebService/Service1">Paul</DomainName>
<Success xmlns="http://tempuri.org/Safenames_IDP_XML_API_WebService/Service1">true</Success>
<CommandName xmlns="http://tempuri.org/Safenames_IDP_XML_API_WebService/Service1">IDP_DomainAvailabilityChecker(S)</CommandName>
<Description xmlns="http://tempuri.org/Safenames_IDP_XML_API_WebService/Service1">Available</Description>
</IDPResults>

The code im working on...

IDPResults(0) = objAPI.IDP_DomainAvailabilityChecker(myLoginKey,
tbData.Text.ToString)

' Try and Serialize class
Dim xmlS1 As New XmlSerializer(GetType(Safenames_WebServices.IDPRes ults))
Dim swri1 As New System.IO.StringWriter
Dim xwri1 As New System.Xml.XmlTextWriter(swri1)

xwri1.Formatting = System.Xml.Formatting.None
xmlS1.Serialize(swri1,
objAPI.IDP_DomainAvailabilityChecker(myLoginKey,
tbData.Text.ToString))

tbXMLUserReceives.Text = swri1.ToString
swri1.Close()
Thanks for your time - No this one is a little long winded.

Paul.
Nov 21 '05 #1
1 4115
Hi,

You can trace the Soap messages with a SoapExtension. Check out
http://www.pickabar.com/blog/archive...cing_soap.html. It should
be straightforward to modify the code to get the traces into your textboxes.

Regards,
Sami

"Paul Hale" <pa*******@safenames.net> wrote in message
news:6b**************************@posting.google.c om...
Im currently developing an API using a vb.net web service. Im very
nearly there as regard to functionality but would like to add a
feature so that users can see exactly what xml is being generated
(sent and received) for each API command.

Picture the scenario. I have a UI which contains the following...

Multiline text box: Friendly response from API (Displays results)
Multiline text box: XML Sent (would like to display xml sent)
Multiline text box: XML Received (would like to display xml received)

The API commands work fine and display the correct results in the
"Friendly response from API" box. Also, if I browse directly to the
Web Service I get a convinient screen showing all exposed commands
(web methods) as hyperlinks that the Web Service contains. If I click
on one of these hyperlinks I get another convinient screen showing
what the method expects to see from a posted SOAP message and a posted
HTTP POST and the responses the method will throw back.

What I would like to do is somehow serialse my API commands so that
when a user clicks an API command button the "XML Sent" and "XML
Received" boxes are automatically populated with what is sent \
recieved behind the scenes.

I think im close (but no cigar) at the moment. Im using the following
code to try and serialse the command \ data type but the response
being displayed in my "XML Received" text box does not match the auto
generated SOAP response which I discussed earlier. Think it may have
something to do with either name spaces or the way SOAP works? Any
ideas or pointers would be very much appriciated.

What my xml should look like...

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<IDP_DomainAvailabilityChecker_SingleResponse
xmlns="http://tempuri.org/Safenames_IDP_XML_API_WebService/Service1">
<IDP_DomainAvailabilityChecker_SingleResult>
<DomainName>string</DomainName>
<Success>boolean</Success>
<CommandName>string</CommandName>
<Description>string</Description>
</IDP_DomainAvailabilityChecker_SingleResult>
</IDP_DomainAvailabilityChecker_SingleResponse>
</soap:Body>
</soap:Envelope>

And what is displayed in my "XML Recived" text box...

<?xml version="1.0" encoding="utf-16"?>
<IDPResults xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DomainName
xmlns="http://tempuri.org/Safenames_IDP_XML_API_WebService/Service1">Paul</DomainName>
<Success
xmlns="http://tempuri.org/Safenames_IDP_XML_API_WebService/Service1">true</Success>
<CommandName
xmlns="http://tempuri.org/Safenames_IDP_XML_API_WebService/Service1">IDP_DomainAvailabilityChecker(S)</CommandName>
<Description
xmlns="http://tempuri.org/Safenames_IDP_XML_API_WebService/Service1">Available</Description>
</IDPResults>

The code im working on...

IDPResults(0) = objAPI.IDP_DomainAvailabilityChecker(myLoginKey,
tbData.Text.ToString)

' Try and Serialize class
Dim xmlS1 As New XmlSerializer(GetType(Safenames_WebServices.IDPRes ults))
Dim swri1 As New System.IO.StringWriter
Dim xwri1 As New System.Xml.XmlTextWriter(swri1)

xwri1.Formatting = System.Xml.Formatting.None
xmlS1.Serialize(swri1,
objAPI.IDP_DomainAvailabilityChecker(myLoginKey,
tbData.Text.ToString))

tbXMLUserReceives.Text = swri1.ToString
swri1.Close()
Thanks for your time - No this one is a little long winded.

Paul.

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1497
by: James | last post by:
Here's what I'm kicking around... Really here's what's kicking me around... Trying to design a webservices system that will allow a client to submit forms in background threads when client connects...
3
1145
by: Paul M | last post by:
Hi there, my web application has a bunch of classes with functions that i'd like some of them to be made into webservices. However, they mostly return arraylists, which have objects stored...
2
3651
by: Corne Rabe | last post by:
Hi all I've got a webservices that will be called by a delphi product. They have defined a soap message that they will use to call my webservice. A header snippet is found below: <soap:Header>...
3
1581
by: James | last post by:
Here's what I'm kicking around... Really here's what's kicking me around... Trying to design a webservices system that will allow a client to submit forms in background threads when client connects...
0
878
by: kejeiri | last post by:
I wish just to draw the attention to the fact, that my MyClass1...and MyClassN are declared "Serializable"... But, I never get my classes methods, I get just attributes (Or methods Properties)...
3
1142
by: Keith Hurst | last post by:
Hi, this is my first post to this group, so please be gentle with me. We have a classic Win32 application and are now transporting that to browser based using VS.NET. Another steep learning...
0
990
by: Bill | last post by:
My computer is a client in the central timezone with daylight savings. I need to pass a time and a value to the server via webservices (for example, the price of electricity at each hour in the...
1
1912
by: Steve | last post by:
I generate C# webservices proxy code from WSDL file, it turns out the classes generated have public member variables and no getter/setter methods as follows, and I am able to get data when...
3
4468
by: Frederik Wehlin | last post by:
Hi, I'm currently developing a windows form application, which should be able to communicate with a couple of WebServices. The Webservices are not created by me or my company and also not in .net...
0
2448
by: =?Utf-8?B?TWljaGFlbA==?= | last post by:
Hello, i have a problem with jagged arrays and a webservice. I try to call a webservice with an array of a class that contains jagged arrays. Here is an example: class MyClass{ string...
0
7125
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7049
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7499
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5631
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5055
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4709
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3199
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3186
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1561
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.