Pregunta

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetPracticeInformation xmlns="http://tempuri.org/">
      <sUserName>string</sUserName>
      <sUserPassword>string</sUserPassword>
      <iPatientId>int</iPatientId>
      <bDocument>boolean</bDocument>
      <iDocumentId>int</iDocumentId>
      <abCypherTextBytes>base64Binary</abCypherTextBytes>
    </GetPracticeInformation>
  </soap:Body>
</soap:Envelope>

Could anyOne help me to pass boolean value,integer value and base64Binary value in the soap string…

I tried like

 NSString *uName = @"Name";
NSString *uPassWord = @"PassWord";
BOOL y = TRUE;
BOOL n = FALSE;
int val = 0;
NSMutableData *myData = [[NSMutableData alloc]initWithCapacity:65000];

NSString *soapMessage =[NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"
"<soap:Body>\n"
"<GetPracticeInformation xmlns=\"http://tempuri.org/\">\n"
"<sUserName>%@</sUserName>\n"
"<sUserPassword>%@</sUserPassword>\n"
"<iPatientId>%d</iPatientId>\n"
"<bDocument>%c</bDocument>\n"
"<iDocumentId>%d</iDocumentId>\n"
"<abCypherTextBytes>%@</abCypherTextBytes>\n"
"</GetPracticeInformation>\n"
"</soap:Body>\n"
"</soap:Envelope>",uName,uPassWord,val,n,val,myData];

But In this case I am getting 0 byte response..

2013-10-15 15:19:34.262 SoapXML[1438:11303] DONE. Received Bytes: 0
2013-10-15 15:19:34.263 SoapXML[1438:11303] out put:  (null)
2013-10-15 15:19:34.265 SoapXML[1438:11303] Error while parsing the document: Error Domain=SMXMLDocumentErrorDomain Code=1 "Malformed XML document. Error at line 1:1." UserInfo=0x7690650 {LineNumber=1, ColumnNumber=1, NSLocalizedDescription=Malformed XML document. Error at line 1:1., NSUnderlyingError=0x7690540 "The operation couldn’t be completed. (NSXMLParserErrorDomain error 5.)"}

Is this proper way to pass values?How To pass Boolean value and base64Binary? ..Please help me.

¿Fue útil?

Solución

Change this line because boolean value requires int value so

<bDocument>%c</bDocument>\n  to <bDocument>%d</bDocument>\n

Otros consejos

I got the solution by passing result(ASCIIEncoding of mydata)

NSMutableData *mydata = [[NSMutableData alloc]initWithCapacity:65000];
    NSString *result= [[NSString alloc]initWithData:mydata encoding:NSASCIIStringEncoding];

In place of base64Binary,I passed the result string and I got The Response properly...

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top