You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by "Bauer, Sandra, vpe" <Sa...@v-pe.de> on 2001/12/06 16:20:34 UTC

WG: Apache-Java-client for .NETwebservice

Sorry, it should be Apache! 

-----Originalnachricht-----
Von: Bauer, Sandra, vpe
An: 'soap-user@xml.apache.org'
Gesendet: 06.12.01 16:17
Betreff: 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
<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
<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
<http://localhost/EchoService/Echo> ] 
[encodingStyleURI= http://schemas.xmlsoap.org/soap/encoding/
<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/
<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
<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/
<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 <http://localhost/Echoservice/Echo>
", 
RequestNamespace=" http://localhost/Echoservice/
<http://localhost/Echoservice/> ", 
ResponseNamespace=" http://localhost/Echoservice/
<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!
---------------------------------------------------------


---------------------------------------------------------
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!
---------------------------------------------------------



---------------------------------------------------------
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!
---------------------------------------------------------


Re: WG: Apache-Java-client for .NETwebservice

Posted by Christian Weyer <ch...@eyesoft.de>.
Another way would be to change the calling logic in your client to 
message oriented. For an overview have a look here:
http://xml.apache.org/soap/docs/guide/msgclient.html
(as opposed to RPC style: 
http://xml.apache.org/soap/docs/guide/rpcclient.html)

HTH,
Christian Weyer
---------------------------------
  .NET XML Web Services Repertory
   http://www.xmlwebservices.cc/
---------------------------------


Christian Weyer wrote:

> Did you try telling your .NET Web Service to produce RPC style messages? 
> This can be achieved by applying the [SoapRpcService] attribute to the 
> Web Service class ...
> 
> Christian Weyer
> ---------------------------------
>  .NET XML Web Services Repertory
>   http://www.xmlwebservices.cc/
> ---------------------------------
> 
> Bauer, Sandra, vpe wrote:
> 
>> Sorry, it should be Apache!



Re: WG: Apache-Java-client for .NETwebservice

Posted by Christian Weyer <ch...@eyesoft.de>.
Another way would be to change the calling logic in your client to 
message oriented. For an overview have a look here:
http://xml.apache.org/soap/docs/guide/msgclient.html
(as opposed to RPC style: 
http://xml.apache.org/soap/docs/guide/rpcclient.html)

HTH,
Christian Weyer
---------------------------------
  .NET XML Web Services Repertory
   http://www.xmlwebservices.cc/
---------------------------------


Christian Weyer wrote:

> Did you try telling your .NET Web Service to produce RPC style messages? 
> This can be achieved by applying the [SoapRpcService] attribute to the 
> Web Service class ...
> 
> Christian Weyer
> ---------------------------------
>  .NET XML Web Services Repertory
>   http://www.xmlwebservices.cc/
> ---------------------------------
> 
> Bauer, Sandra, vpe wrote:
> 
>> Sorry, it should be Apache!



Re: WG: Apache-Java-client for .NETwebservice

Posted by Christian Weyer <ch...@eyesoft.de>.
Did you try telling your .NET Web Service to produce RPC style messages? 
This can be achieved by applying the [SoapRpcService] attribute to the 
Web Service class ...

Christian Weyer
---------------------------------
  .NET XML Web Services Repertory
   http://www.xmlwebservices.cc/
---------------------------------

Bauer, Sandra, vpe wrote:

> Sorry, it should be Apache!
> 
> -----Originalnachricht-----
> Von: Bauer, Sandra, vpe
> An: 'soap-user@xml.apache.org'
> Gesendet: 06.12.01 16:17
> Betreff: 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.



Re: WG: Apache-Java-client for .NETwebservice

Posted by Christian Weyer <ch...@eyesoft.de>.
Did you try telling your .NET Web Service to produce RPC style messages? 
This can be achieved by applying the [SoapRpcService] attribute to the 
Web Service class ...

Christian Weyer
---------------------------------
  .NET XML Web Services Repertory
   http://www.xmlwebservices.cc/
---------------------------------

Bauer, Sandra, vpe wrote:

> Sorry, it should be Apache!
> 
> -----Originalnachricht-----
> Von: Bauer, Sandra, vpe
> An: 'soap-user@xml.apache.org'
> Gesendet: 06.12.01 16:17
> Betreff: 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.