Microsoft web services use SOAPAction to determine the method to
execute.  Your call.invoke is specifying an empty string.  The WSDL for
the service will show you the SOAPAction.

Also, have you written the .NET web service to use rpc/encoded?  Apache
SOAP always sends rpc/encoded messages.  You do this with the
SoapRpcService attribute, e.g.

 [SoapRpcService, WebService(Namespace="urn:echo-test-1")]
 public class EchoTest1Service : System.Web.Services.WebService {
 ...

Scott Nichol

----- Original Message -----
From: "Siddhartha Mehta" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 07, 2002 3:20 PM
Subject: Accessing C# Web service from Java Client...


>
> Hi,
>
> I am using APACHE SOAP 2.2 for my Java client. I am trying to access
the web services written in C#.NET. After compiling my code I get the
following exception about content type:
>
> Caught SOAPException (SOAP-ENV:Protocol): Unsupported response content
type &quot;text/plain; charset=utf-8&quot;, must be:
&quot;text/xml&quot;. Response was:
> System.InvalidOperationException: Request format is invalid: text/xml;
charset=utf-8.
>    at
System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
>    at System.Web.Services.Protocols.WebServiceHandler.Invoke()
>    at
System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
>
>
>
> I've also pasted below my code. I'm trying to access a Login function
on my SOAP Web Server with 2 parameters, LoginName and Password (both
values, "q").
>
>
>
> import java.io.*;
>
> import java.util.*;
>
> import java.net.*;
>
> import org.w3c.dom.*;
>
> import org.apache.soap.util.xml.*;
>
> import org.apache.soap.*;
>
> import org.apache.soap.encoding.*;
>
> import org.apache.soap.encoding.soapenc.*;
>
> import org.apache.soap.rpc.*;
>
> import org.apache.soap.transport.http.SOAPHTTPConnection;
>
> public class StoragePoint
>
> {
>
> public static void main(String[] args) throws Exception
>
> {
>
>
>
> URL url = new URL ("http://localhost/soap/SoapUser.asmx/Login";);
>
>
>
> SOAPMappingRegistry smr = new SOAPMappingRegistry ();
>
> StringDeserializer sd = new StringDeserializer ();
>
> smr.mapTypes (Constants.NS_URI_SOAP_ENC, new QName ("", "Result"),
null, null, sd);
>
> // create the transport and set parameters
>
> SOAPHTTPConnection st = new SOAPHTTPConnection();
>
> // build the call.
>
> Call call = new Call ();
>
> call.setSOAPTransport(st);
>
> call.setSOAPMappingRegistry (smr);
>
> call.setTargetObjectURI ("http://tempuri.org/message/";);
>
> call.setMethodName("Login");
>
> call.setEncodingStyleURI
("http://schemas.xmlsoap.org/soap/encoding/";);
>
> Vector params = new Vector();
>
> params.addElement(new Parameter("LoginName", String.class, "q",
null));
>
> params.addElement(new Parameter("Password", String.class, "q", null));
>
> call.setParams(params);
>
> Response resp = null;
>
> try
>
> {
>
> resp = call.invoke (url, "");
>
> }
>
> catch (SOAPException e)
>
> {
>
> System.err.println("Caught SOAPException (" + e.getFaultCode () + "):
" + e.getMessage ());
>
> return;
>
> }
>
> // check response
>
>
>
> if (resp != null && !resp.generatedFault())
>
> {
>
> Parameter ret = resp.getReturnValue();
>
> Object value = ret.getValue();
>
> System.out.println ("Answer--> " + value);
>
> }
>
> else
>
> {
>
> Fault fault = resp.getFault ();
>
> System.err.println ("Generated fault: ");
>
> System.out.println (" Fault Code = " + fault.getFaultCode());
>
> System.out.println (" Fault String = " + fault.getFaultString());
>
> }
>
> }
>
> }
>
>
>
> Any help/suggestions is HIGHLY appreciated. I even used SUN's JAXP and
I get the same error message.
>
> Thanks in ADVANCE!!
>
> Siddhartha
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to