Link to home
Start Free TrialLog in
Avatar of Rimvis
RimvisFlag for Lithuania

asked on

Problems working with .NET WebService and SOAP SDK 3.0

Hi all, here's my situation:

I have web service created in VB.NET. When client that calls this service is created in .NET languages, there's no problem.
But I have to call this service from VC++ 6.0 client.

Right now I'm trying SOAP SDK 3.0. When working with simple methods without parameters, everything is OK. But when I'm putting some parameters, I'm getting exception like this:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <soap:Fault>
      <faultcode>soap:Server</faultcode>
      <faultstring>System.Web.Services.Protocols.SoapException: Server was unable to process request. ---&gt; System.NullReferenceException: Object reference not set to an instance of an object.
   at WST1.Service1.Capitalize(String sText) in \\xxxxx.xxx.xx\Tests$\WST1\Service1.asmx.vb:line 55
   --- End of inner exception stack trace ---</faultstring>
      <detail />
    </soap:Fault>
  </soap:Body>
</soap:Envelope>

I don't want to create some .NET wrappers for this, because I want to make it as simple as possible.


I think problem is in SOAP request differrences between SOAP 3.0 and .NET

Is there any way arround?



Avatar of nauman_ahmed
nauman_ahmed
Flag of United States of America image

Avatar of Rimvis

ASKER

Thanx for response, Nauman

Unfortunately. I couldn't find anything that might help me in your links.
As I said, web service is written in .NET. And my client will be VC 6.0. I can't do anything about it, because these components will be part of already existing system.
In your articles web service is created using same SOAP SDK (unless I'm missing something).

Right now I see two approaches: a) connect to .NET web service using SOAP 3.0 SDK; b) format request and parse result at HTTP POST level. Alas, I'm struggling with both :(

Checkout the following link:

http://www.dotnet247.com/247reference/msgs/15/79837.aspx

It says you will need SOAP Toolkit 2.0 for VC6.  

-Nauman.
The solution for your problem is similart ...

How to Call WebService from Legacy ASP or VBS

*** Problem Description ***
Is it possible to call a webservice from a 'conventional' asp application?
i.e. from an asp page?

*** Resolution ***
1. Soap ToolKit2.0 (download from http://msdn.microsoft.com/soap):

Set SoapClient = CreateObject("MSSOAP.SoapClient") Call
SoapClient.mssoapinit("http://localhost/webservice1/service1.asmx?wsdl";)
MsgBox (SoapClient.CanYouTellMe("3"))

2. If you have the .net framework installed on the ASP machine, generate a
.net web service client proxy, mark it wit [ComVisible=true], and invoke it
as a
com object.

3. ServerXMLHTTP or XMLHTTP: Set oServerXML =
CreateObject("Msxml2.ServerXMLHTTP") oServerXML.Open "GET",
"http://localhost/WebService1/Service1.asmx/CanYouTellMe?index=10";, False
oServerXML.setRequestHeader "Content-Type",
"application/x-www-form-urlencoded" MsgBox oServerXML.responseText Set
oServerXML = nothing

HTH, Nauman.
Avatar of Rimvis

ASKER

Hi, Nauman

I reverted to SOAP 2.0, but still no luck. Calls to methods with parameters failes.
Avatar of Rimvis

ASKER

I found solution myself. It's quite simple:
http://www.forum4designers.com/archive26-2004-8-73505.html

To call NET web service by using SOAP SDK, methods in web service have to be declared like this:

    <WebMethod(), SoapRpcMethod()> _
    Public Function HelloWorld() As String
        Return "Hello World. Time is " & Now.TimeOfDay.ToString
    End Function

Note additional SoapRpcMethod().
ASKER CERTIFIED SOLUTION
Avatar of OzzMod
OzzMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial