2012-01-02 19 views
0

:代わりに形式のSOAP応答

<soap:Envelope> 
<soap:Body> 
<CustomRS attr="somevalue"> 
<Success/> 
</CustomRS> 
</soap:Body> 
</soap:Envelope> 

を、私は

<soap:Envelope> 
<soap:Body> 
<PingResponse> 
<CustomRS attr="somevalue"> 
<Success/> 
</CustomRS> 
</PingResponse> 
</soap:Body> 
</soap:Envelope> 

「Ping]を」この応答を取得することです私のWebMethodとCustomRSの名前は私のシリアライズ可能なレスポンスオブジェクトです。 PingResponse要素を取り除き、ルート要素としてCustomRSを使用するにはどうすればよいですか?

マイ実装

@WebService (name = '', serviceName = ''targetNamespace = '') 
@Stateless (mappedName = '') 

public class TestEjb implements Testnterface { 
@SOAPBinding(style=Style.DOCUMENT, use=Use.LITERAL, parameterStyle=ParameterStyle.BARE) 

@WebResult (name = "CustomRS", targetNamespace = "name space") 
@WebMethod (operationName = "CustomRS") 
public CustomRS_OutPut Ping(@WebParam (name = "header",Type type, 
    @WebParam (name = "parameters", Param param) throws Exception 
{ 

} 

答えて

0
public SoapObject soap(String METHOD_NAME, String SOAP_ACTION, 
      String NAMESPACE, String URL) throws IOException, 
      XmlPullParserException { 
     SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); // set up 
                     // request 
     request.addProperty("iTruckId", "1"); 
     request.addProperty("iLocationId", "1");// variable name, value. I got 
               // the variable name, from the 
               // wsdl file! 
     SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
       SoapEnvelope.VER11); // put all required data into a soap 
             // envelope 
     envelope.setOutputSoapObject(request); // prepare request 
     AndroidHttpTransport httpTransport = new AndroidHttpTransport(URL); 
     httpTransport.debug = true; // this is optional, use it if you don't 
            // want to use a packet sniffer to check 
            // what the sent 
            // message was (httpTransport.requestDump) 
     httpTransport.call(SOAP_ACTION, envelope); // send request 
     SoapObject result = (SoapObject) envelope.getResponse(); // get response 
     return result; 
    } 
} 
関連する問題