0

Androidでリクエストエンベロープを使用してSOAPサービスを呼び出すにはどうすればよいですか. 私はSockettimeoutExceptionを取得しています。エンドポイント: e1jas01.domain.cssus.com:8091/DV910/AddressBookManager?WSDL

//Soap Request...

    <Envelope>
   <Body>
      <getAddressBookV2Element>
        <Entity>
            <EntityId>9</EntityId>
         </Entity>
      </getAddressBookV2Element>
   </Body>
</Envelope>

//Androidコード... //私が試した方法の下。

public void callWebservice()
{
    private final String NAMESPACE1 = "http://oracle.e1.bssv.JP010000/";
    private final String URL1 = "https://e1jas01.domain.cssus.com:8091/DV910/AddressBookManager";
    private final String SOAP_ACTION1 = "http://oracle.e1.bssv.JP010000//getAddressBookV2";

    private final String METHOD_NAME1 = "getAddressBookV2";

    SoapObject request = new SoapObject(NAMESPACE1, METHOD_NAME1);
   PropertyInfo weightProp =new PropertyInfo();
    weightProp.name = "arg0";
    weightProp.setValue("9");
    request.addProperty(weightProp);
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    // create header
    Element[] header = new Element[1];
    header[0] = new Element().createElement("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd","Security");
    header[0].setAttribute(null, "mustUnderstand","1");
    Element usernametoken = new Element().createElement("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "UsernameToken");
    usernametoken.setAttribute(null, "Id", "UsernameToken-1");
    header[0].addChild(Node.ELEMENT,usernametoken);
    Element username = new Element().createElement(null, "n0:Username");
    username.addChild(Node.IGNORABLE_WHITESPACE,"Gowtham");
    usernametoken.addChild(Node.ELEMENT,username);
    Element pass = new Element().createElement(null,"n0:Password");
    pass.setAttribute(null, "Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText");
    pass.addChild(Node.TEXT, "Gowtham");
    usernametoken.addChild(Node.ELEMENT, pass);
    Element[] body = new Element[1];
    body[0] = new Element().createElement("http://oracle.e1.bssv.JP010000/","getAddressBookV2Element");
    Element EntityNode = new Element().createElement("http://oracle.e1.bssv.JP010000/", "Entity");
    body[0].addChild(Node.ELEMENT,EntityNode);
    Element EntityIdNode = new Element().createElement("http://oracle.e1.bssv.JP010000/", "EntityId");
    EntityIdNode.addChild(Node.IGNORABLE_WHITESPACE,"9");
    EntityNode.addChild(Node.ELEMENT,EntityIdNode);

    // add header to envelope
    envelope.headerOut = header;
    envelope.bodyOut = body;
    envelope.dotNet = false;
    envelope.bodyOut = request;
    envelope.setOutputSoapObject(request);
    HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
    try 
    {
        androidHttpTransport.debug = true;
        androidHttpTransport.call(SOAP_ACTION, envelope);
        SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
        Log.i("myApp", response.toString());
    } 
    catch (SoapFault e)
    {
        e.printStackTrace();
    }
    catch (Exception e) 
    {
        e.printStackTrace();
        Log.d("Exception Generated", ""+e.getMessage());
    }
}

また、Soap 本体の Element の代わりに Propertyinfo を追加しようとしましたが、それでも例外が発生します。同じエンベロープは、soapUI ツールでもうまく機能します。一人でこれを修正するのを手伝ってください。

ありがとう、ゴーサム。

4

1 に答える 1