2012-02-26 21 views
0

私はWSを作成し、Webアプリケーション内でTomcatにデプロイし、スタブを使って呼び出しようとしています。Axis2例外org.apache.axis2.AxisFault:スタブを使用している文字列

私は、WSDLのベースとしてこのインタフェースを使用しています:

package com.at.iscrizio.ws.services; 
public interface SalutareService { 
    public String sayciao(String name);  
} 

とWSDLファイルを生成するには、このスクリプトは、サーバーとファイルを展開し、クライアント側のファイル:

set WSDL_FILE=SalutareService.wsdl 
set TO_WSDL=%AXIS2_HOME%/bin/java2wsdl.bat 
set TO_JAVA=%AXIS2_HOME%/bin/wsdl2java.bat 
set CLASS=com.at.iscrizio.ws.services.SalutareService 
set SOAP_ADDR=http://localhost:9090/Iscrizio/services/SalutareServiceEx 

call %TO_WSDL% -cp build/classes -o ./wsdl -of %WSDL_FILE% -cn %CLASS% -l %SOAP_ADDR% 
call %TO_JAVA% -uri wsdl/%WSDL_FILE% -S generated -o axis -ss -sd -ssi --noWSDL 
call %TO_JAVA% -uri wsdl/%WSDL_FILE% -S generated -o axis 

これは、これは1トンから私のservice.xmlに(少し異なっている私のWS実装

package com.at.iscrizio.ws.services; 
public class SalutareServiceEx implements SalutareServiceSkeletonInterface { 
    @Override 
    public SayciaoResponse sayciao(Sayciao sayciao) { 
    SayciaoResponse resp = new SayciaoResponse(); 
    resp.set_return("Ciao"); 
    return resp; 
    } 
} 

です帽子標準軸が)ちょうどServiceClassを変更するには、生成されたbuild.xml:

<?xml version="1.0" encoding="UTF-8"?> 
<!-- This file was auto-generated from WSDL --> 
<!-- by the Apache Axis2 version: 1.6.1 Built on : Aug 31, 2011 (12:22:40 CEST) --> 
<serviceGroup> 
    <service name="SalutareServiceEx"> 
     <messageReceivers> 
      <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"  class="com.at.iscrizio.ws.services.SalutareServiceMessageReceiverInOut"/> 
     </messageReceivers> 
     <parameter name="ServiceClass">com.at.iscrizio.ws.services.SalutareServiceEx</parameter> 
     <parameter name="useOriginalwsdl">true</parameter> 
     <parameter name="modifyUserWSDLPortAddress">true</parameter> 
     <operation name="sayciao" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://services.ws.iscrizio.at.com"> 
      <actionMapping>urn:sayciao</actionMapping> 
      <outputActionMapping>urn:sayciaoResponse</outputActionMapping> 
     </operation> 
    </service> 
</serviceGroup> 

のserver-config.wsdd内部では、私が持っている:

<handler name="Trace" type="java:com.at.iscrizio.ws.handler.TraceHandler"/> 
    <service name="SalutareServiceEx" provider="java:RPC"> 
    <requestFlow> 
    <handler type="Trace"/> 
    </requestFlow> 
    <parameter name="allowedMethods" value="sayciao"/> 
    <parameter name="scope" value="Request"/> 
    <parameter name="className" value="com.at.iscrizio.ws.services.SalutareServiceEx"/> 
</service> 

私はページhttp://localhost:9090/Iscrizio/services/SalutareServiceEx?wsdl

を見ることができますよ

我々は終わりに近いです...コードのこの部分で、私は、WSを呼び出すためにスタブを使用しています:

SalutareServiceStub stub = new SalutareServiceStub(); 
SalutareServiceStub.Sayciao param = new SalutareServiceStub.Sayciao(); 
param.setName("Antonio"); 
SalutareServiceStub.SayciaoResponse resp = stub.sayciao(param); 
System.out.println(resp); 

要求が私のハンドラ(wsddの中で定義されたもの)を通過すると、リモートデバッグを使用して見ることができます。 tcpmonのを使用して、私は私の要求を見ました:

<?xml version="1.0" encoding="UTF-8"?> 
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"> 
    <soapenv:Body> 
    <ns1:sayciao xmlns:ns1="http://services.ws.iscrizio.at.com"> 
     <ns1:name>Antonio</ns1:name> 
    </ns1:sayciao> 
    </soapenv:Body> 
</soapenv:Envelope> 

とWSの応答:

<?xml version="1.0" encoding="UTF-8"?> 
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"  xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema- instance"> 
<soapenv:Body> 
    <soapenv:Fault> 
    <soapenv:Code> 
     <soapenv:Value>soapenv:Sender</soapenv:Value> 
     <soapenv:Subcode xmlns:ns1="http://www.w3.org/2003/05/soap-rpc"> 
      <soapenv:Value>ns1:BadArguments</soapenv:Value> 
     </soapenv:Subcode> 
    </soapenv:Code> 
    <soapenv:Reason> 
     <soapenv:Text xml:lang="en">string</soapenv:Text> 
    </soapenv:Reason> 
    <soapenv:Detail> 
     <ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">anto-note</ns2:hostname> 
    </soapenv:Detail> 
    </soapenv:Fault> 
</soapenv:Body> 
</soapenv:Envelope> 

これは、スタックトレースです:

Exception in thread "main" org.apache.axis2.AxisFault: string 
    at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531) 
    at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375) 
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421) 
    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) 
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) 
    at com.at.iscrizio.ws.services.SalutareServiceStub.sayciao(SalutareServiceStub.java:185) 
    at com.at.iscrizio.ws.client.TestClient.main(TestClient.java:25) 

どこに問題がありますか?すべてのおかげで、巨大な投稿のために失礼します

+0

soapuiを使用してサービスを呼び出そうとしましたか?それはあなたの問題があなたのクライアントかあなたのサーバー側であるかどうかを教えてくれるでしょう – davidfrancis

+0

これは石鹸の中のノードです:本文: antonio WSからの同じ応答。 – Antonio

答えて

0

少なくとも、それは問題を抱えていたサーバーの終わりです。 soapuiが生成しているreqは元のreqとは異なりますか?奇妙に聞こえますが、ソープイイが普通です。個人的に私はサーバーの端をデバッグし、どこが間違っているかを特定しようとします。たとえば、いくつかの例外ブレークポイントを設定します。

+0

コメントは、コメントとしてそれを意味しました! – davidfrancis

+0

問題はデプロイメントの問題でした。 2日前、私はWebアプリケーションの中にwsを配備しました。昨日私はaxis2 webapplication内に展開しようとしました。多分私はこのような何かの設定を忘れてしまったでしょう。ありがとう、ダビド。 – Antonio

関連する問題