hi,
Actually my aim is to trace the Soap Request and Response Payload between
the Web Service and Client Application.
I developed my service in C#. My Client Application is in VB 6.0.
Here is the Code:
VB Client:
----------
Private Sub GetPayload_Click()
Dim xmldom
Set xmldom = CreateObject("Microsoft.XMLDOM")
Set pi = xmldom.createProcessingInstruction("xml", " version=""1.0""")
xmldom.insertBefore pi, xmldom.childNodes.Item(0)
Set objXMLroot = xmldom.createNode(1, "SOAP:Envelope", "http://schemas.xmlsoap.org/soap/envelope/")
xmldom.appendChild (objXMLroot)
objXMLroot.setAttribute "xmlns:soapspenc", "http://schemas.xmlsoap.org/soap/encoding/"
objXMLroot.setAttribute "xmlns:xsi", "http://www.w3.org/1999/XMLSchema-instance"
objXMLroot.setAttribute "xmlns:xsd", "http://www.w3.org/1999/XMLSchema"
Set objxmlbody = xmldom.createElement("SOAP:Body")
xmldom.documentElement.appendChild (objxmlbody)
Set objxmlmethod1 = xmldom.createNode(1, "IsValidUser", "http://tempuri.org/")
objxmlbody.appendChild (objxmlmethod1)
Set objxmlparam1 = xmldom.createNode(1, "userid", "http://tempuri.org/")
objxmlparam1.Text = Trim(tuserid.Text)
objxmlmethod1.appendChild (objxmlparam1)
Set objxmlparam2 = xmldom.createNode(1, "password", "http://tempuri.org/")
objxmlparam2.Text = Trim(tpassword.Text)
objxmlmethod1.appendChild (objxmlparam2)
MsgBox xmldom.xml, vbOKOnly, "Soap Request Payload from Client"
xmldom.save ("C:\test.xml")
Set XMLHTTP = CreateObject("Microsoft.XMLHTTP")
XMLHTTP.Open "POST", "http://muma:8080/mysamples1/User/WebService1.asmx", False
XMLHTTP.setRequestHeader "SOAPAction", "http://tempuri.org/IsValidUser"
XMLHTTP.setRequestHeader "Content-Type", "text/xml"
XMLHTTP.send (xmldom)
MsgBox XMLHTTP.responseText, vbOKOnly, "Soap Response Payload from Server"
End Sub
WebService1.asmx
----------------
<%@ WebService Language="c#" Codebehind="WebService1.cs" Class="User.WebService1" %>
WebService1.cs
--------------
namespace User
{
using System;
using System.Collections;
using System.Configuration;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
public class WebService1 : System.Web.Services.WebService
{
public WebService1()
{
InitializeComponent();
}
private void InitializeComponent()
{
}
public override void Dispose()
{
}
[WebMethod]
public string IsValidUser(string userid,string password)
{
if((userid == "199") && (password == "uma"))
{
return "true";
}
else
{
return userid+password;
}
}
}
}
Actually, in this sample I built the Soap Request Payload by hand using the Microsoft.XMLDOM
object and called the Web Service using Microsoft.XMLHTTP object.
This application works fine and I am very well able to trace the Http-Soap
Request and Response payload using the TcpTracer Tool which I downloaded
from www.pocketsoap.com
Here actually my doubt is apart from building the Soap Request payload
manually and calling the Service, Is there any other way that I can call
the Web Service directly?
Please go through my code and give ur suggestions.
Thank You.
Regards,
Uma
maheswarim@r...