You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by HariNam Singh <hs...@elite.com> on 2001/07/02 17:52:27 UTC

C# and Apache SOAP interoperability...

... or just someone not knowing C# well enough ;-)

Here is the story. I downloaded Apache SOAP 2.2 and wrote Java web service
for it. The Java client for it works fine as well. As a proof of concept, I
wrote a C# client to it. The client can successfully invoke Apache web
services. Though, it just can't deal with the response that it gets back.
The MS documentation is either horrible or well hidden ;-) Does anyone have
some ideas.

Please, find below
1. C# source code
2. C# runtime output
3. HTTP response captured by tunnel utility.

Thanks a lot,
HariNam

namespace Dude
{// Allow easy reference System namespace classes
using System;
using System.Xml.Serialization;
using System.Web.Services.Protocols;
using System.Web.Services;

// This "class" exists only to house entry-point
class MainApp2 : SoapClientProtocol {

   public MainApp2() {
      Console.WriteLine("in constructor");
      this.Url = "http://172.25.3.55:8081/soap/servlet/rpcrouter";
   }

 
[System.Web.Services.Protocols.SoapMethodAttribute(RequestNamespace="swifta"
)]
   public void soapRead(String queue) {
     Console.WriteLine("begin soapRead");
     try {
      this.Url = "http://172.25.3.55:8081/soap/servlet/rpcrouter";
      object[] result = this.Invoke("soapRead", new string[] {queue});
      Console.WriteLine("in soapSend" + result[0]);
     } catch(Exception ex) {
      Console.WriteLine(ex.ToString());
      Console.WriteLine("caught exception" + this.Url);
     }
   }
}

class MainApp {

   // Static method "Main" is application's entry point
   public static void Main() {
      // Write text to the console
      Console.WriteLine("Hello World using C#!");
//      (new MainApp2()).soapSend();
      MainApp2 app2 = new MainApp2();
      app2.soapRead("testqueue@router1");
      Console.WriteLine("after method call");
   }
}
}

-------------------------------------------------------


C:\Documents and Settings\hsingh\mine>Proxy3
Hello World using C#!
in constructor
begin soapSend
System.Exception: The request failed with HTTP status code 200 and the error
mes
sage:
--
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xm
lns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org
/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:soapSendResponse xmlns:ns1="swifta"
SOAP-ENV:encodingStyle="http://schemas.
xmlsoap.org/soap/encoding/">
</ns1:soapSendResponse>

</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

--.
   at
System.Web.Services.Protocols.SoapClientProtocol.ReadResponse(SoapClientMe
ssage message, HttpClientResponse response)
   at System.Web.Services.Protocols.SoapClientProtocol.Invoke(String
methodName,
 Object[] parameters)
   at Dude.MainApp2.soapSend(String queue, String message)
caught exceptionhttp://172.25.3.55:8081/soap/servlet/rpcrouter
after method call

-----------------------------------------------------------------

HTTP/1.0
200 OK
Content-Type: text/xml;
charset=utf-8 Content-Length: 413 Set-Cookie2: JSESSIONID=0nb1rxxrv1;
Version=1;
Discard;Path="/soap" Set-Cookie: JSESSIONID=0nb1rxxrv1;
Path=/soap Servlet-Engine: Tomcat Web Server/3.2.2 (JSP 1.1; Servlet 2.2;
Java 1.3.1; Windows 2000 5.0 x86; java.vendor=Sun Microsyste
<?xml version='1.0' encoding='UTF-8'?>
 <SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
     xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" 
      xmlns:xsd="http://www.w3.org/1999/XMLSchema">
 <SOAP-ENV:Body>
    <ns1:soapSendResponse xmlns:ns1="swifta" SOAP-       
         E NV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    </ns1:soapSendResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

-----Original Message-----
From: Chiranjeevi Paruchur [mailto:CParuchur@orga.com]
Sent: Monday, July 02, 2001 7:54 AM
To: soap-user@xml.apache.org
Subject: Re: Deployment error while running addressbook



Thanks Tom,

It just worked.

Chiran


 

                    Tom Myers

                    <tommyers@dream        To:     soap-user@xml.apache.org

                    scape.com>             cc:     soap-user@xml.apache.org

                                           Subject:     Re: Deployment error
while running addressbook               
                    02/07/01 16:48

                    Please respond

                    to soap-user

 

 





At 03:38 PM 7/2/2001 +0200, Chiranjeevi Paruchur wrote:
... Fault String = Deployment error in SOAP service 'urn:AddressFetcher':
class na
>me 'samples.addressbook.Address' could not be resolved:
samples.addressbook.Addr
>ess
>
>MY CLIENT CLASSPATH
>
>Client
CLASSPATH=/opt/colada/soap-2_2/lib/soap.jar:/opt/colada/javamail/mail.jar:/o
pt/c
>olada/jaf/activation.jar:/opt/colada/xerces-1_4_1/xerces.jar:/opt/tomcat/li
b/:/o
>pt/java1.3/tools.jar:.:/opt/colada/soap-2_2
>
>
>MY SERVER CLASSPATH
>
>Sever
CLASSPATH=/opt/colada/soap-2_2/lib/soap.jar:/opt/colada/javamail/mail.jar:/o
pt/c
>olada/jaf/activation.jar:/opt/colada/xerces-1_4_1/xerces.jar:/opt/tomcat/li
b/

The Address class is in soap-2_2/samples/addressbook/Address.class, and is
needed by
both client and server code. Your client path contains /opt/colada/soap-2_2,
but the
server does not. (or maybe I'm just not seeing something, again.)

Tom Myers





Encoding question: 'char', List, etc.

Posted by Kyle Morris <ky...@sabre.com>.
I notice that the Apache SOAP (v2.2) package
org.apache.soap.encoding.soapenc  includes serializers for most of the
primitive types as well as classes like java.util.Vector.

Why not for the 'char' primitive type?

Why not java.util.List (well, ok, this one might be explained by not wanting
to require JDK 1.2)?

Kyle



Encoding question: 'char', List, etc.

Posted by Kyle Morris <ky...@sabre.com>.
I notice that the Apache SOAP (v2.2) package
org.apache.soap.encoding.soapenc  includes serializers for most of the
primitive types as well as classes like java.util.Vector.

Why not for the 'char' primitive type?

Why not java.util.List (well, ok, this one might be explained by not wanting
to require JDK 1.2)?

Kyle