Expand my Community achievements bar.

Problem sending complex xml data to webservice ?

Avatar

Former Community Member
All,

I have a requirement where complex data should be sent as  webservice method parameters. The webservice receives only partially/ corrupted data so it failes. I confirmed that before calling webservice send my xml data is well formed.

My webservice call definition :

<mx:WebService
     id="uploadContentService"
     wsdl="http://151.108.233.50:7011/services/cs/CreateOrUpdateServicePort?wsdl"
      useProxy="false"
      showBusyCursor="true" >
       <mx:operation name="createorupdateDoc" resultFormat="e4x">      
       <mx:request xmlns:ws="http://ws.cs.xxxx.com/"></mx:request>
       </mx:operation>
</mx:WebService>

My xml formation and webservice call :

public function callUploadContentService(uploadContentVO:UploadContentVO, credentialsVO:CredentialsVO): void
  { 
  namespace ns = "http://ws.cs.xxxxx.com/";
  use namespace ns;
 
  var qualityContent:String = "<sp_quality_document>" +   
  "<object_name>" + uploadContentVO.name + "</object_name>"+
            "<a_content_type>" + uploadContentVO.contentType + "</a_content_type>"+ 
            "<id></id>"+
            "<version_type>"+
              "<version_label></version_label>"+
            "</version_type>"+       
            "<content>"+
              "<ucf>"+
                  "<uid>" + uploadContentVO.uId + "</uid>" +
                  "<jsessionid>" + uploadContentVO.jsessionId + "</jsessionid>" +                 
                  "<filepath>" + uploadContentVO.filepath + "</filepath>"+
                "<ip_address>" + uploadContentVO.ipaddress + "</ip_address>" +       
              "</ucf>" +
            "</content>" +
  "</sp_quality_document>";

  var credentialContent:String =
  "<sp_credentials_doc>"+
  "<sp_user>" + credentialsVO.user + "</sp_user>"+
            "<sp_password>" + credentialsVO.cookie + "</sp_password>"+
            "<sp_docbase>" + credentialsVO.docbase + "</sp_docbase>"+
  "</sp_credentials_doc>";

 
  var xmlquality:XML = new XML(qualityContent).normalize();
  var xmlCredentials:XML = new XML(credentialContent).normalize();
  //var xmluploadContent:XML = new XML(uploadContent).normalize();
 
  var token : AsyncToken = service.createorupdateDoc.send(xmlCredentials+xmlquality);//Only xmlCredentials data reaches webservice but xml quality object is all null
  token.addResponder(responder);   
   
  }

My SOAP Request :

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.cs.standardandpoors.com/">
  <soapenv:Header/>
  <soapenv:Body>
      <ws:createorupdateDoc>
               
        <sp_quality_document>
            <object_name>ktest0915_qpm3</object_name>
            <id></id>
            <!--Optional:-->
            <version_type>
              <version_label>SAME</version_label>
            </version_type>
            <content>
              <!--Optional:-->
              <ucf>
                  <uid>1</uid>
                  <jsessionid>T1l6KslcmKr4JbcGKXnZdTvfZzJ9Kyp5tL8FtwDgvB3dJnc9jJ98!2002756995</jsessionid>
                  <filepath>C:\TestUpload.doc</filepath>
          <ip_address>151.108.233.50</ip_address>       
              </ucf>
            </content>
        </sp_quality_document>
       
        <sp_credentials_doc>
            <sp_user>csdev</sp_user>
            <sp_password>csdev</sp_password>
            <sp_docbase>csps_dev1</sp_docbase>
        </sp_credentials_doc>
      </ws:createorupdateDoc>
  </soapenv:Body>
</soapenv:Envelope>

Thanks,
Karthik

0 Replies