473,544 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sending XML SOAP message directly to web service from 3rd party app.

I have a vb.net web service and client that are both working fine.
If someone wanted to consume our web service using .NET, no problem.
Im a little confused on how non .NET clients would use the web service
though.

Question 1: Does Java etc have some kind of SOAP tool kit developers
could use to access our web service?

Question 2: .NET conveniently shows what the serialized xml looks like
and what the web service expects (Please see below). If I somehow
posted this xml directly to the web service would my client receive a
valid response? I have tried this (to no avail) but am not sure if im
supposed to post the xml or send using some kind of stream writer?

What I would love to do is create a simple client form containing a
multiline text box, post the xml into text box (see below) then
somehow send the contents of the text box containing xml to the web
service and receive back a response. Im sure this must be simple
(guess im kind of avoiding the .net web service proxy) but am stuck.

Anybody got any links to some info which may help me please?

Example xml i would like to post directly to web service...

POST /api/Safenames_IDP_X ML_API_WebServi ce/Safenames_IDP_X ML_API.asmx
HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/Safenames_IDP_X ML_API_WebServi ce/Service1/IDP
DomainAvailabil ityChecker(Logi nKey as string, DomainNames as
DomainArrayClas s)"

<?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_x0020_Doma inAvailabilityC hecker_x0028_Lo ginKey_x0020_as _x0020_string_x 002C__x0020_Dom ainNames_x0020_ as_x0020_Domain ArrayClass_x002 9_
xmlns="http://tempuri.org/Safenames_IDP_X ML_API_WebServi ce/Service1">
<LoginKey>strin g</LoginKey>
<DomainNames>
<DomainArrayCla ss>
<DomainName>str ing</DomainName>
<Success>boolea n</Success>
<CommandName>st ring</CommandName>
<Description>st ring</Description>
</DomainArrayClas s>
<DomainArrayCla ss>
<DomainName>str ing</DomainName>
<Success>boolea n</Success>
<CommandName>st ring</CommandName>
<Description>st ring</Description>
</DomainArrayClas s>
</DomainNames>
</IDP_x0020_Domai nAvailabilityCh ecker_x0028_Log inKey_x0020_as_ x0020_string_x0 02C__x0020_Doma inNames_x0020_a s_x0020_DomainA rrayClass_x0029 _>
</soap:Body>
</soap:Envelope>
Nov 21 '05 #1
2 15427
MJ
I am sure that there Java Toolkits but it's quite while since I have
programmed in Java :)

But, more helpfully, the code below takes the contents of a multiline
textbox control, txtMessageBody, and uses an System.Net.Http WebRequest
object to send the SOAP Envelope to the specified ASMX file with the
specified SOAPAction header. It then saves the response to a
response.xml file which is then loaded in to a WebBroswer control,
browser. Thus displaying the response to the request on a Winform but
with full IE XML rendering features.

There are possibly better ways of doing this but it has worked for me
when I was in a hurry and needed to test by service.

HTH.

string messageBody = "";
byte[] messageBytes;
HttpWebRequest webRequest =
(HttpWebRequest )WebRequest.Cre ate("http://localhost/api/Safenames_IDP_X ML_API_WebServi ce/Safenames_IDP_X ML_API.asmx");
webRequest.Cont entType = "text/xml; charset=utf-8";
webRequest.Head ers.Add
"SOAPAction","h ttp://tempuri.org/Safenames_IDP_X ML_API_WebServi ce/Service1/IDPDomainAvaila bilityChecker(L oginKey
as string, DomainNames as DomainArrayClas s)");
webRequest.Meth od = "POST";

messageBody = "<?xml version="1.0"
encoding="utf-8"?><SOAP-ENV:Envelope
xmlns:SOAPENV=' http://schemas.xmlsoap .org/soap/envelope/'><SOAP-ENV:Body>";

messageBody = txtMessageBody. Text;

messageBody += "</SOAP-ENV:Body></SOAP-ENV:Envelope>";
webRequest.Cont entLength = messageBody.Len gth;
messageBytes = Encoding.ASCII. GetBytes(messag eBody);
Stream requestStream = webRequest.GetR equestStream();
requestStream.W rite(messageByt es,0,messageByt es.Length);
HttpWebResponse webResponse =null;
Stream responseStream = null;

try
{
webResponse = (HttpWebRespons e)webRequest.Ge tResponse();
responseStream = webResponse.Get ResponseStream( );
byte[] response = new byte[webResponse.Con tentLength];
responseStream. Read(response,0 ,response.Lengt h);
string file = "response.x ml";
StreamWriter writer = new StreamWriter(fi le,false);
writer.Write(En coding.ASCII.Ge tString(respons e));
writer.Close();
string path = Application.Exe cutablePath;
path= path.Substring( 0, path.IndexOf(Ap plication.Produ ctName +
".exe"));
browser.Navigat e(path + file);
}
catch(Exception ex)
{
MessageBox.Show (ex.Message);
}
finally
{
responseStream. Close();
if(webResponse != null)
{
webResponse.Clo se();
}
requestStream.C lose();
}

pa*******@safen ames.net (Paul Hale) wrote in message news:<6b******* *************** ****@posting.go ogle.com>...
I have a vb.net web service and client that are both working fine.
If someone wanted to consume our web service using .NET, no problem.
Im a little confused on how non .NET clients would use the web service
though.

Question 1: Does Java etc have some kind of SOAP tool kit developers
could use to access our web service?

Question 2: .NET conveniently shows what the serialized xml looks like
and what the web service expects (Please see below). If I somehow
posted this xml directly to the web service would my client receive a
valid response? I have tried this (to no avail) but am not sure if im
supposed to post the xml or send using some kind of stream writer?

What I would love to do is create a simple client form containing a
multiline text box, post the xml into text box (see below) then
somehow send the contents of the text box containing xml to the web
service and receive back a response. Im sure this must be simple
(guess im kind of avoiding the .net web service proxy) but am stuck.

Anybody got any links to some info which may help me please?

Example xml i would like to post directly to web service...

POST /api/Safenames_IDP_X ML_API_WebServi ce/Safenames_IDP_X ML_API.asmx
HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/Safenames_IDP_X ML_API_WebServi ce/Service1/IDP
DomainAvailabil ityChecker(Logi nKey as string, DomainNames as
DomainArrayClas s)"

<?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_x0020_Doma inAvailabilityC hecker_x0028_Lo ginKey_x0020_as _x0020_string_x 002C__x0020_Dom ainNames_x0020_ as_x0020_Domain ArrayClass_x002 9_
xmlns="http://tempuri.org/Safenames_IDP_X ML_API_WebServi ce/Service1">
<LoginKey>strin g</LoginKey>
<DomainNames>
<DomainArrayCla ss>
<DomainName>str ing</DomainName>
<Success>boolea n</Success>
<CommandName>st ring</CommandName>
<Description>st ring</Description>
</DomainArrayClas s>
<DomainArrayCla ss>
<DomainName>str ing</DomainName>
<Success>boolea n</Success>
<CommandName>st ring</CommandName>
<Description>st ring</Description>
</DomainArrayClas s>
</DomainNames>
</IDP_x0020_Domai nAvailabilityCh ecker_x0028_Log inKey_x0020_as_ x0020_string_x0 02C__x0020_Doma inNames_x0020_a s_x0020_DomainA rrayClass_x0029 _>
</soap:Body>
</soap:Envelope>

Nov 21 '05 #2
Hi Paul,

Absolutely... but the quality of these Java tools vary wildly. The most
notoriously "pull your hair out" is called Glue. The best ones are from
Systinet, IBM (Websphere) and Bea.

On your question # 2, the automatic documentation page doesn't fully expand
members of complex types that are passed as arguments. As such, it's not
always possible to directly copy/paste. If you install a trace extension
into your web service (available on gotdotnet for free) and then use
trace.axd to monitor the packets as they are run, then you can see the
exact content of what was passed on the wire.
Here's an HTML test form I use to do simple testing such as you describe.

Good luck

Dan Rogers
Microsoft Corporation

---------
<HTML>
<SCRIPT LANGUAGE="VBScr ipt">

sub postit(theform)
set xmlhttp = CreateObject("M sxml2.XMLHTTP")
url = "http://" + theform.serverN ame.value + "/"+ theform.dsmlURL .value
xmlhttp.open "POST", url,false
xmlhttp.setRequ estHeader "SOAPAction ", theform.soapAct ion.value
xmlhttp.setRequ estHeader "Content-type", "text/xml"
theform.respons eEl.value = ""
xmlhttp.send theform.request El.value
theform.respons eEl.value = xmlhttp.respons etext
xmldoc.src = xmlhttp.respons exml

end sub
</SCRIPT>
<BODY>
<FORM target="_blank" name="myform" METHOD="post" ACTION="postit" >
<FONT face="Arial"><F ONT color="#000099" ><FONT size="7">SOAP Test
Client</FONT><br>
</FONT></FONT>
<P><font face="Verdana" size="2"> Server Name&nbsp; <input type="text"
name="serverNam e" size="29" value="localhos t" id="Text1">
&nbsp;&nbsp; Virtual Directory <input type="text" name="dsmlURL"
size="50" value="AddressS ervice/AddressService. asmx">&nbsp;
<br>
<br>
SOAP Action&nbsp; <INPUT id="Text3" type="text" size="85"
value='GetTestA ddress' name="soapActio n"></font></P>
<P><FONT face="Verdana" size="2"><B>SOA P&nbsp;request: </B><font
color="#0000ff" > </font>
</FONT>
</P>
<p>
<TEXTAREA fontsize="large " vscroll="true" rows="10" cols="110"
name="requestEl " value="">
</TEXTAREA>
<p>
<INPUT TYPE="button" Value="Send Request" OnClick="postit (myform)">
<P>
<b><font face="Verdana" size="2">The&nb sp;SOAP response: </font></b>
<p>
<TEXTAREA rows="20" cols="110" name="responseE l" value="">
</TEXTAREA>
<br>
<XML id="xmldoc" src="" ></XML>
&nbsp;</FORM>
</P>
</BODY>
</HTML>
------- <snip>
Nov 23 '05 #3

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

Similar topics

4
7867
by: Mark | last post by:
i have a very simple web servive Imports System.Web.Services <System.Web.Services.WebService(Namespace:="urn:Example1")> _ Public Class Example1 Inherits System.Web.Services.WebService
3
7038
by: mark kurten | last post by:
I have a soap message that looks like this. s = s & " <soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'" s = s & " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" s = s & " xmlns:xsd='http://www.w3.org/2001/XMLSchema'>" s = s & " <soap:operation soapAction='urn:Example1/HelloWorld' style='document' />" s = s & "...
0
2234
by: Cleo | last post by:
Hi, I am trying to call a WebService Method written in Weblogic from VB.NET and I am getting the following error. I am using SOAP Caal s from VB.NET. Please find the wsdl file and my code. Any help would really be appreciated. Thx
0
2626
by: jennifer.perkins | last post by:
I've seen a couple posts by people having similar problems, but the suggested solutions I've tried so far haven't worked. I'm using a SOAP client in VB.Net (constructed by wsdl.exe) and the third party web service it's consuming is served by Axis. The request messages my client sends are processed fine by the server, and the SOAP response...
2
3244
by: Kups | last post by:
Hi! I have a service and client that use WSE 2.0 and soap.tcp. Both are behind firewalls. Client connects to a public machine's tcp port which is redirected to service. If I send a request to service, it is received, but I can't get the answer. Here is the message from event log:
4
2245
by: Jonathan [sbrodolo] | last post by:
Hi there, I am using a LOTUS/DOMINO Web Service in my ASP.Net application and I am having quite a lot of problems. I have managed to solve most of them but this one it really is giving me terrible headaches. Web Service send's me back an XML that I have managed to read with an enormous quantity of problems (it sends me back an XML file with...
31
2789
by: Bryan Dickerson | last post by:
Ok, simple question: from a VB.Net web service (as I've said before, I'm a newbie to SOAP), how would I get the SOAP body into a string? My boss and I concur that it, at least from our perspective, should be as simple as defining an object and viewing a parameter on that object. My boss has worked with it and I'm still tryin'... TIA! ...
1
2099
by: Peter van der veen | last post by:
Hi I have a problem in VB.net 2.0 We are using a third party webservice. I have loaded the wsdl file and can access the functions the service has. Now this party wants that we add a SOAP header element named 'Vendor' so that they can distinguis which vendor called the webservice.
0
2219
by: vigneshrao | last post by:
Hi, I have been working on a script that loops through multiple records and sends data (one record per call) to a WS. I am supposed to make a new call for each record before sending the data. The problem I have is the first record gets processed fine where as the second record always; reason being the EAI expects it to be a seperate call...
0
7763
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7701
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5901
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5289
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...
0
4908
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...
0
3402
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1834
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
1
983
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
654
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...

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.