2011-11-11 21 views
1

複合クラスパラメータをwsdlに送信する際に例外が発生しています。KSOAPで複合パラメータを送信する際の問題

私の応答では、私は、このログを取得しています:ここで

Exception: SoapFault - faultcode: 'S:Server' faultstring: 'javax.xml.bind.UnmarshalException - with linked exception:[javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,471]Message: Element type "systemGenerated" must be followed by either attribute specifications, ">" or "/>".]' faultactor: 'null' detail: [email protected]:::::::::::::::::::::::::::::::::::0Access00000000 BuyLimitLimit02233.000000001000.00.00.0 
Response>>>>>>>in exceptionnnn>>>>>>>>>>S:Serverjavax.xml.bind.UnmarshalException - with linked exception:[javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,471]Message: Element type "systemGenerated" must be followed by either attribute specifications, ">" or "/>".]javax.xml.bind.UnmarshalException - with linked exception:

は、そのための私のコードスニペットです。メンバーは私にそれのための解決策を提供してください。

  SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 


      MarshalDouble md = new MarshalDouble();// **this class is made to parse the double values** 

      md.register(envelope); 

      SoapObject rpc = new SoapObject(serviceNamespace, "getTradeOrderTotal"); 

      envelope.dotNet = false; 

      envelope.setOutputSoapObject(rpc); 

      envelope.encodingStyle = SoapSerializationEnvelope.XSD; 



      envelope.addMapping(serviceNamespace, "MTradeOrder", new MTradeOrder().getClass()); 


      MTradeOrder mt = new MTradeOrder(); //This is my complex class implementing kvmserializable. 


     /* mt.portfolioName=AppScreen.name2; 
      mt.securityName=AppScreen.symbol11; // These are the parameters that i am setting to my complex class 
      mt.orderType=AppScreen.ordertype; 
      mt.priceType=AppScreen.Pricetype; 
      mt.quantityRequested=AppScreen.quantity1; 
      mt.orderTermName=ActiveTradeOrder.orderterm; 
      mt.limitPrice=AppScreen.limitprice;*/ 


      PropertyInfo pi = new PropertyInfo(); 
     // pi.type=MarshalDouble.class; 


      rpc.addProperty("arg0", new MTradeOrder()); 




      HttpTransportBasicAuth ht = new HttpTransportBasicAuth(serviceUrl, AppScreen.wsunS, AppScreen.wspwdS); 
      ht.debug = true; 

      String result; 
      try 
      { 

       ht.call(soapAction, envelope); 

       result = (envelope.getResponse()).toString(); 

       System.out.println("Request::::::dump::::::::::::::::::::::::::::: \n" + ht.requestDump); 

       System.out.println("Response>>>>>>>>>>>>>>>>> \n" + ht.responseDump); 


       UiApplication.getUiApplication().invokeLater(new Runnable() { 
        public void run() 
        { 
         Dialog.alert("Login Successful!"); 
        } 
       }); 

      } 
      catch (Exception ex) 
      { 
       result = ex.toString(); 
       System.out.println("Exception: " + result); 
       System.out.println("Request::::::::::::::::::::::::::::::::::: \n" + ht.requestDump); 
       System.out.println("Response>>>>>>>in exceptionnnn>>>>>>>>>> \n" + ht.responseDump); 
       UiApplication.getUiApplication().invokeLater(new Runnable() { 
        public void run() 
        { 
         Dialog.alert("Login Unsuccessful!\nPlease try again."); 
        } 
       }); 
      } 

     } 

答えて

0

私はあなたが本当にオブジェクトがnullでないことを確認してください[「パイ」&クラスインスタンス「MT」プロパティを送信されるべきだと思います。 rpc.addProperty行に値を設定します。そう、

rpc.addProperty(pi, mt);

と同じように、私は一般的に、このようにそれを実行します。



    String CLASS_NAME = "Complex object class name"; // set this according to your wsdl complex object name 
    PropertyInfo pi = new PropertyInfo(); 
    pi.name = (CLASS_NAME); 
    pi.type = mt.getClass(); // class instance used with get class 
    request.addProperty(pi, mt); // add the property 


    // finally add mapping 
    final SoapSerializationEnvelope env = new SoapSerializationEnvelope(SoapEnvelope.VER11); 
    env.addMapping(NAMESPACE, CLASS_NAME, new MTradeOrder().getClass()); 

はこちらをご覧ください、それが役立つかもしれない: Complex Objects and Ksoap2

関連する問題