开发者

Blackberry soap response

开发者 https://www.devze.com 2023-04-12 16:30 出处:网络
I am trying to consume .net webservices, and I can establish the connection. However this is the response I am getting:

I am trying to consume .net webservices, and I can establish the connection. However this is the response I am getting:

[0.0] anyType{NewDataSet=anyType{Table=anyType{Card_ID_PK=2243; PAN=63369610009001016; Expiry_Date[0.0] =15/06/2015; Embossed_Name=IDL IG scheme; 

I want them to split and display it as a table. I searched in google and I found some methods like split() but that can only delimit single character and also I need the way to remove the characters and use them as key value pair which is used for .

Here is my code for soap:

       // TODO Auto-generated method stub
    if (DeviceInfo.isSimulator()) {
        URL = URL + ";deviceSide=true";
    }

        SoapObject rpc = new SoapObject(NAMESPACE, METHOD_NAME);    //soap object to open the namespace and method name
        rpc.addProperty("CH_ID","15");              
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);                     

    envelope.bodyOut = rpc;
    System.out.println("envelope response"+envelope.bodyOut.toString());
    envelope.dotNet = true;                                                                                                                    
    envelope.encodingStyle = SoapSerializationEnvelope.XSD;             
    System.out.println("in soap");

    envelope.setOutputSoapObject(rpc);

        HttpTransport ht = new HttpTransport(URL);          
        ht.debug = true;                    
       try {
    System.out.println("int try");
    ht.call(SOAP_ACTION, envelope);                 
              System.out.println("int try");

               SoapObject resultProperties = (SoapObject) envelope.getResponse();       
            System.out.println("IN TRY");
                                            String res=开发者_如何学运维resultProperties.getProperty(1).toString();
            System.out.println("Response"+res);

            String[] pattern={"{","}","anytype","Table",";"};
            String replacement="";
            String array=replaceall(res,pattern,replacement);


                System.out.println(" array element:"+array[i]);

replace all method :

   public String replaceall(String str, String[] pattern, String replacement)
       {
    if(str==null)
    {
        return "";
    }
    StringBuffer sb=new StringBuffer();

    int index=-1;
    String workingSource = str;

        for(int i=0;i<pattern.length;i++)
    {
    while ((index = workingSource.indexOf(pattern[i])) != -1)
    {

        sb.append(workingSource.substring(0, index));
                sb.append(replacement);

        sb.append(workingSource.substring(index + pattern[i].length()));

                workingSource = sb.toString();

                sb.delete(0, sb.length());
    }
    }


    return workingSource;




}

}

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号