472,356 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,356 software developers and data experts.

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_XML_API_WebService/Safenames_IDP_XML_API.asmx
HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/Safenames_IDP_XML_API_WebService/Service1/IDP
DomainAvailabilityChecker(LoginKey as string, DomainNames as
DomainArrayClass)"

<?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_x0020_DomainAvailabilityChecker_x0028_LoginKe y_x0020_as_x0020_string_x002C__x0020_DomainNames_x 0020_as_x0020_DomainArrayClass_x0029_
xmlns="http://tempuri.org/Safenames_IDP_XML_API_WebService/Service1">
<LoginKey>string</LoginKey>
<DomainNames>
<DomainArrayClass>
<DomainName>string</DomainName>
<Success>boolean</Success>
<CommandName>string</CommandName>
<Description>string</Description>
</DomainArrayClass>
<DomainArrayClass>
<DomainName>string</DomainName>
<Success>boolean</Success>
<CommandName>string</CommandName>
<Description>string</Description>
</DomainArrayClass>
</DomainNames>
</IDP_x0020_DomainAvailabilityChecker_x0028_LoginKey _x0020_as_x0020_string_x002C__x0020_DomainNames_x0 020_as_x0020_DomainArrayClass_x0029_>
</soap:Body>
</soap:Envelope>
Nov 21 '05 #1
2 15316
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.HttpWebRequest
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.Create("http://localhost/api/Safenames_IDP_XML_API_WebService/Safenames_IDP_XML_API.asmx");
webRequest.ContentType = "text/xml; charset=utf-8";
webRequest.Headers.Add
"SOAPAction","http://tempuri.org/Safenames_IDP_XML_API_WebService/Service1/IDPDomainAvailabilityChecker(LoginKey
as string, DomainNames as DomainArrayClass)");
webRequest.Method = "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.ContentLength = messageBody.Length;
messageBytes = Encoding.ASCII.GetBytes(messageBody);
Stream requestStream = webRequest.GetRequestStream();
requestStream.Write(messageBytes,0,messageBytes.Le ngth);
HttpWebResponse webResponse =null;
Stream responseStream = null;

try
{
webResponse = (HttpWebResponse)webRequest.GetResponse();
responseStream = webResponse.GetResponseStream();
byte[] response = new byte[webResponse.ContentLength];
responseStream.Read(response,0,response.Length);
string file = "response.xml";
StreamWriter writer = new StreamWriter(file,false);
writer.Write(Encoding.ASCII.GetString(response));
writer.Close();
string path = Application.ExecutablePath;
path= path.Substring(0, path.IndexOf(Application.ProductName +
".exe"));
browser.Navigate(path + file);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
responseStream.Close();
if(webResponse != null)
{
webResponse.Close();
}
requestStream.Close();
}

pa*******@safenames.net (Paul Hale) wrote in message news:<6b**************************@posting.google. 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_XML_API_WebService/Safenames_IDP_XML_API.asmx
HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/Safenames_IDP_XML_API_WebService/Service1/IDP
DomainAvailabilityChecker(LoginKey as string, DomainNames as
DomainArrayClass)"

<?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_x0020_DomainAvailabilityChecker_x0028_LoginKe y_x0020_as_x0020_string_x002C__x0020_DomainNames_x 0020_as_x0020_DomainArrayClass_x0029_
xmlns="http://tempuri.org/Safenames_IDP_XML_API_WebService/Service1">
<LoginKey>string</LoginKey>
<DomainNames>
<DomainArrayClass>
<DomainName>string</DomainName>
<Success>boolean</Success>
<CommandName>string</CommandName>
<Description>string</Description>
</DomainArrayClass>
<DomainArrayClass>
<DomainName>string</DomainName>
<Success>boolean</Success>
<CommandName>string</CommandName>
<Description>string</Description>
</DomainArrayClass>
</DomainNames>
</IDP_x0020_DomainAvailabilityChecker_x0028_LoginKey _x0020_as_x0020_string_x002C__x0020_DomainNames_x0 020_as_x0020_DomainArrayClass_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="VBScript">

sub postit(theform)
set xmlhttp = CreateObject("Msxml2.XMLHTTP")
url = "http://" + theform.serverName.value + "/"+ theform.dsmlURL.value
xmlhttp.open "POST", url,false
xmlhttp.setRequestHeader "SOAPAction", theform.soapAction.value
xmlhttp.setRequestHeader "Content-type", "text/xml"
theform.responseEl.value = ""
xmlhttp.send theform.requestEl.value
theform.responseEl.value = xmlhttp.responsetext
xmldoc.src = xmlhttp.responsexml

end sub
</SCRIPT>
<BODY>
<FORM target="_blank" name="myform" METHOD="post" ACTION="postit">
<FONT face="Arial"><FONT 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="serverName" size="29" value="localhost" id="Text1">
&nbsp;&nbsp; Virtual Directory <input type="text" name="dsmlURL"
size="50" value="AddressService/AddressService.asmx">&nbsp;
<br>
<br>
SOAP Action&nbsp; <INPUT id="Text3" type="text" size="85"
value='GetTestAddress' name="soapAction"></font></P>
<P><FONT face="Verdana" size="2"><B>SOAP&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&nbsp;SOAP response: </font></b>
<p>
<TEXTAREA rows="20" cols="110" name="responseEl" 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
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
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 =...
0
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. ...
0
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...
2
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 ...
4
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...
31
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...
1
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...
0
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....
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
1
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

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.