在Android中的Eway Recurring Payment

时间:2016-06-17 13:05:35

标签: android payment-gateway recurring-billing

如何解决

当我调用soap服务时,这是响应,当我得到这种类型的响应时,eway文档仅提供api但不提供解决方案。

anyType{Result=Fail; ErrorSeverity=Error; ErrorDetails=The 'eWayCustomerID' element has an invalid value according to its data type.; RebillCustomerID=0; }

这是我的代码

 public void callWebservice()
    {
        SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
        Request.addProperty("customerTitle", "Mr");
        Request.addProperty("customerFirstName", "kk");
        Request.addProperty("customerLastName", "mine");
        Request.addProperty("customerAddress", "");
        Request.addProperty("customerSuburb", "");
        Request.addProperty("customerState", "");
        Request.addProperty("customerCompany", "");
        Request.addProperty("customerPostCode", "");
        Request.addProperty("customerCountry", "");
        Request.addProperty("customerEmail", "");
        Request.addProperty("customerFax", "");
        Request.addProperty("customerPhone1", "");
        Request.addProperty("customerPhone2", "");
        Request.addProperty("customerRef", "Ref1234");
        Request.addProperty("customerJobDesc", "");
        Request.addProperty("customerComments", "Please Ship ASASP");
        Request.addProperty("customerURL", "");


        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

        envelope.headerOut = new Element[1];
        envelope.headerOut[0] = buildAuthHeader();

        Log.i("header", "" + envelope.headerOut.toString());

        envelope.dotNet = true;
        envelope.bodyOut = Request;
        envelope.setOutputSoapObject(Request);
        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
        Log.i("bodyout", "" + envelope.bodyOut.toString());

        try {
            androidHttpTransport.debug = false;
            androidHttpTransport.call(SOAP_ACTION, envelope);

            SoapObject response = (SoapObject)envelope.getResponse();
//            SoapPrimitive resultString = (SoapPrimitive) envelope.getResponse();
            Log.i("myApp", response.toString());
            System.out.println("*****" + response.toString());
        }
        catch (SoapFault e)
        {
            e.printStackTrace();
        }
        catch (Exception e)
        {
            e.printStackTrace();
            Log.d("Exception Generated", "" + e.getMessage());
        }
    }

    private Element buildAuthHeader()
    {
        Element h = new Element().createElement(NAMESPACE, "AuthHeader");
        Element ewayCId = new Element().createElement(NAMESPACE,"eWAYCustomerID");
        ewayCId.addChild(Node.TEXT,"");
        h.addChild(Node.ELEMENT,ewayCId);
        Element username = new Element().createElement(NAMESPACE, "Username");
        username.addChild(Node.TEXT, "");
        h.addChild(Node.ELEMENT, username);
        Element pass = new Element().createElement(NAMESPACE, "Password");
        pass.addChild(Node.TEXT, "");
        h.addChild(Node.ELEMENT, pass);

        return h;
    }

请帮助我。

答案很感谢,谢谢

0 个答案:

没有答案