473,662 Members | 2,666 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:Envelop e xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:soap="htt p://schemas.xmlsoap .org/soap/envelope/">
<soap:Body>
<IDP_DomainAvai labilityChecker _SingleResponse
xmlns="http://tempuri.org/Safenames_IDP_X ML_API_WebServi ce/Service1">
<IDP_DomainAvai labilityChecker _SingleResult>
<DomainName>str ing</DomainName>
<Success>boolea n</Success>
<CommandName>st ring</CommandName>
<Description>st ring</Description>
</IDP_DomainAvail abilityChecker_ SingleResult>
</IDP_DomainAvail abilityChecker_ 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_X ML_API_WebServi ce/Service1">Paul</DomainName>
<Success xmlns="http://tempuri.org/Safenames_IDP_X ML_API_WebServi ce/Service1">true</Success>
<CommandName xmlns="http://tempuri.org/Safenames_IDP_X ML_API_WebServi ce/Service1">IDP_D omainAvailabili tyChecker(S)</CommandName>
<Description xmlns="http://tempuri.org/Safenames_IDP_X ML_API_WebServi ce/Service1">Avail able</Description>
</IDPResults>

The code im working on...

IDPResults(0) = objAPI.IDP_Doma inAvailabilityC hecker(myLoginK ey,
tbData.Text.ToS tring)

' Try and Serialize class
Dim xmlS1 As New XmlSerializer(G etType(Safename s_WebServices.I DPResults))
Dim swri1 As New System.IO.Strin gWriter
Dim xwri1 As New System.Xml.XmlT extWriter(swri1 )

xwri1.Formattin g = System.Xml.Form atting.None
xmlS1.Serialize (swri1,
objAPI.IDP_Doma inAvailabilityC hecker(myLoginK ey,
tbData.Text.ToS tring))

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

Paul.
Nov 21 '05 #1
1 4122
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*******@safe names.net> wrote in message
news:6b******** *************** ***@posting.goo gle.com...
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:Envelop e xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:soap="htt p://schemas.xmlsoap .org/soap/envelope/">
<soap:Body>
<IDP_DomainAvai labilityChecker _SingleResponse
xmlns="http://tempuri.org/Safenames_IDP_X ML_API_WebServi ce/Service1">
<IDP_DomainAvai labilityChecker _SingleResult>
<DomainName>str ing</DomainName>
<Success>boolea n</Success>
<CommandName>st ring</CommandName>
<Description>st ring</Description>
</IDP_DomainAvail abilityChecker_ SingleResult>
</IDP_DomainAvail abilityChecker_ 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_X ML_API_WebServi ce/Service1">Paul</DomainName>
<Success
xmlns="http://tempuri.org/Safenames_IDP_X ML_API_WebServi ce/Service1">true</Success>
<CommandName
xmlns="http://tempuri.org/Safenames_IDP_X ML_API_WebServi ce/Service1">IDP_D omainAvailabili tyChecker(S)</CommandName>
<Description
xmlns="http://tempuri.org/Safenames_IDP_X ML_API_WebServi ce/Service1">Avail able</Description>
</IDPResults>

The code im working on...

IDPResults(0) = objAPI.IDP_Doma inAvailabilityC hecker(myLoginK ey,
tbData.Text.ToS tring)

' Try and Serialize class
Dim xmlS1 As New XmlSerializer(G etType(Safename s_WebServices.I DPResults))
Dim swri1 As New System.IO.Strin gWriter
Dim xwri1 As New System.Xml.XmlT extWriter(swri1 )

xwri1.Formattin g = System.Xml.Form atting.None
xmlS1.Serialize (swri1,
objAPI.IDP_Doma inAvailabilityC hecker(myLoginK ey,
tbData.Text.ToS tring))

tbXMLUserReceiv es.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
1506
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 to server ( like with Outlook ). So I think webservices is great for this. I can't quite sort out the offline part of things though. I can instantiate and fill the xsd.exe classes I created from a schema. I can't quite sort out how to save these...
3
1150
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 inside them and when i try execute, it spits back exception errors. any advice?
2
3666
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> <mm:TheHeader xmlns:mm="http://The URL"> <SomeValue>123</SomeValue> <AnotherValue>blabla</AnotherValue> </mm:TheHeader >
3
1587
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 to server ( like with Outlook ). So I think webservices is great for this. I can't quite sort out the offline part of things though. I can instantiate and fill the xsd.exe classes I created from a schema. I can't quite sort out how to save these...
0
886
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) !!!!... Must I declare my classes methods as webmethod's too ? Best Regards As I know, in the WebServices context using VB.net we can serialize classes and get all attributes (Or properties methods) of any class just including it at a head of the...
3
1151
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 curve to get to grips with. 3 Tier - Presentation Layer, Business Logic Layer, Data Server Layer. In the Business Logic Layer a colleague of mine is proposing that we access
0
996
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 future). Suppose I want to send these four times and values to the server: 2006-10-29 05:30 GMT, $1.50 2006-10-29 06:30 GMT, $1.60 2006-10-29 07:30 GMT, $1.23 2006-10-29 08:30 GMT, $1.35 Since my computer is in the central timezone, there is no...
1
1918
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 running the client. public class MyFeeResponse {
3
4477
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 but WebMethods (Java I suppose). The first Issue that I have is when instantiating one of webservices I get a "Method myMethod can not be reflected" error message and when drilling down the exception hierarchy I find: InnerException = {"'date' is...
0
2458
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 myJaggedArray; string anotherString; }
0
8435
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8857
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
6186
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5655
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4181
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4348
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2763
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 we have to send another system
2
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1754
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.