Title: Aache-Java-client for .NETwebservice

Hello,

I've written a Java client(Apache SOAP) with JBuilder,
which should communicate with my webservice written un C#.
The client sends a string, which he gets over a GUI, to
the webservice. The webservice sends back the
message: "Hello"+string.

I call the webservice with: 
resp = call.invoke
(url , "http://localhost/EchoService/Echo");

(My namespace is called "Webservice", my Service ich
called "EchoService" and the method is called "Echo".)

I call for the response like this:
try {
      System.out.println(url);
      resp = call.invoke
(url , "http://localhost/EchoService/Echo");
      }
    catch(SOAPException ex) {
      System.err.println("Caught SOAPException (" +
ex.getFaultCode() + "):" + ex.getMessage());
      System.exit(-1);
      }

    if (resp != null) {
      ret = resp.getReturnValue();
      System.out.println("resp object is: " + resp);
      Object value = ret.getValue();
      System.out.println("value object is: " + value);
      try {
        System.out.println("getPartCount returns: " +
resp.getPartCount());
      }
      catch(javax.mail.MessagingException e){
        System.out.println("Exception caught: " + e);
      }
    }
    else {
      Fault fault = resp.getFault();
      System.err.println("Generated fault: ");
      System.err.println(" Fault Code = " +
fault.getFaultCode());
      System.err.println(" Fault String = " +
fault.getFaultString());
      }

    String serviceResponse = value.toString();
    return serviceResponse;
    }
}

Now I get the following response:
Invoke this call: [Header=null] [methodName=Echo]
[targetObjectURI=http://localhost/EchoService/Echo]
[encodingStyleURI=http://schemas.xmlsoap.org/soap/encoding/
] [SOAPContext=[Parts={}]] [Params={[[name=txt]
[type=class java.lang.String] [value="String,which I
enter"]
[encodingStyleURI=http://schemas.xmlsoap.org/soap/encoding/
]]}]
resp object is: [Header=null] [methodName=null]
[targetObjectURI=null] [encodingStyleURI=null]
[SOAPContext=[Parts={[cid:null type: text/xml; charset=utf-
8 enc: null]}]] [fault=[Attributes={}]
[faultCode=soap:Client]
[faultString=System.Web.Services.Protocols.SoapException:
Server did not recognize the value of HTTP Header
SOAPAction: http://localhost/EchoService/Echo.
   at
System.Web.Services.Protocols.SoapServerProtocol.Initialize
()
   at
System.Web.Services.Protocols.ServerProtocolFactory.Create
(Type type, HttpContext context, HttpRequest request,
HttpResponse response)] [faultActorURI=null]
[DetailEntries=
] [FaultEntries=]] [Params={}]
Exception occurred during event dispatching:
java.lang.NullPointerException
        at hellowebservice.TestClient.callService
(TestClient.java:85)
        at
hellowebservice.UserInterface.jButton1_actionPerformed
(UserInterface.java:87)
        at hellowebservice.UserInterface$1.actionPerformed
(UserInterface.java:59)
        at javax.swing.AbstractButton.fireActionPerformed
(AbstractButton.java:1450)
        at
javax.swing.AbstractButton$ForwardActionEvents.actionPerfor
med(AbstractButton.java:1504)
        at
javax.swing.DefaultButtonModel.fireActionPerformed
(DefaultButtonModel.java:378)
        at javax.swing.DefaultButtonModel.setPressed
(DefaultButtonModel.java:250)
        at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased
(BasicButtonListener.java:216)
        at java.awt.Component.processMouseEvent
(Component.java:3717)
        at java.awt.Component.processEvent
(Component.java:3546)
        at java.awt.Container.processEvent
(Container.java:1167)
        at java.awt.Component.dispatchEventImpl
(Component.java:2595)
        at java.awt.Container.dispatchEventImpl
(Container.java:1216)
        at java.awt.Component.dispatchEvent
(Component.java:2499)
        at
java.awt.LightweightDispatcher.retargetMouseEvent
(Container.java:2458)
        at java.awt.LightweightDispatcher.processMouseEvent
(Container.java:2223)
        at java.awt.LightweightDispatcher.dispatchEvent
(Container.java:2132)
        at java.awt.Container.dispatchEventImpl
(Container.java:1203)
        at java.awt.Window.dispatchEventImpl
(Window.java:918)
        at java.awt.Component.dispatchEvent
(Component.java:2499)
        at java.awt.EventQueue.dispatchEvent
(EventQueue.java:336)
        at
java.awt.EventDispatchThread.pumpOneEventForHierarchy
(EventDispatchThread.java:134)
        at
java.awt.EventDispatchThread.pumpEventsForHierarchy
(EventDispatchThread.java:101)
        at java.awt.EventDispatchThread.pumpEvents
(EventDispatchThread.java:96)
        at java.awt.EventDispatchThread.run
(EventDispatchThread.java:88)

So I think, my Webservice don't undrestad the request. But
why? Here's my webservice:
namespace SandraWebservice
{
[WebService(Namespace="http://localhost/EchoService/")]
  public class EchoService : System.Web.Services.WebService
  [WebMethod(Description="Enter a name and this Webservice
returns 'Hello' with this name")]
[System.Web.Services.Protocols.SoapRpcMethodAttribute
("http://localhost/Echoservice/Echo",
RequestNamespace="http://localhost/Echoservice/",
ResponseNamespace="http://localhost/Echoservice/")]
                public string Echo(string txt) {
                        return "Hello " + txt;
                }}





---------------------------------------------------------
This Mail has been checked for Viruses
Attention: Encrypted mails can NOT be checked!

**

Diese Mail wurde auf Viren geprueft
Hinweis: Verschluesselte mails koennen NICHT auf Viren geprueft werden!
---------------------------------------------------------

Reply via email to