objective c - convert SOAP request to iOS soap message -


i have been working soap request , tested soapui , working good. when include in soapmeassage in ios , test it, error in response , can't parse data

the working request

<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:prod="http://schemas.datacontract.org/2004/07/prodigydal.model.search">    <soapenv:header/>    <soapenv:body>       <tem:getlatestnews>          <!--optional:-->          <tem:websiteid>1</tem:websiteid>          <!--optional:-->          <tem:languageid>2</tem:languageid>          <!--optional:-->          <tem:categoryid>105</tem:categoryid>          <!--optional:-->          <tem:currentnewsuniquename>0</tem:currentnewsuniquename>          <!--optional:-->          <tem:pageinfo>             <!--optional:-->             <prod:pagenumber>0</prod:pagenumber>             <!--optional:-->             <prod:pagesize>3</prod:pagesize>             <!--optional:-->             <prod:totalrowcount>0</prod:totalrowcount>          </tem:pageinfo>       </tem:getlatestnews>    </soapenv:body> </soapenv:envelope> 

my soapmessage

nsstring *soapmessage = [nsstring stringwithformat:                          @"<?xml version=\"1.0\" encoding=\"utf-8\"?>""<soapenv:envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\"http://tempuri.org/\" xmlns:prod=\"http://schemas.datacontract.org/2004/07/prodigydal.model.search/\">"                          "<soapenv:header/>"                          "<soapenv:body>"                          "<getlatestnews>"                          "<websiteid>1</websiteid>"                          "<languageid>2</languageid>"                          "<categoryid>105</categoryid>"                          "<currentnewsuniquename>0<currentnewsuniquename>"                          "<pageinfo><a:pagenumber>0</a:pagenumber><a:pagesize>3</a:pagesize><a:totalrowcount>0</a:totalrowcount></pageinfo>"                          "</getlatestnews>"                          "</soapenv:body>"                          "</soapenv:envelope>"];  nsurl *url = [nsurl urlwithstring:@"http://demoserver.tacme.net:3030/xxxxx/xxxxx/xxxxxx.svc"];     nsmutableurlrequest *therequest = [nsmutableurlrequest requestwithurl:url];      nsstring *msglength = [nsstring stringwithformat:@"%d", [soapmessage length]];      [therequest addvalue: @"demoserver.tacme.net:3030" forhttpheaderfield:@"host"];     [therequest addvalue: @"text/xml; charset=utf-8" forhttpheaderfield:@"content-type"];     [therequest addvalue: @"http://tempuri.org/xxxxxx/xxxxxxx" forhttpheaderfield:@"soapaction"];     [therequest addvalue: msglength forhttpheaderfield:@"content-length"];     [therequest sethttpmethod:@"post"];          [therequest sethttpbody: [soapmessage datausingencoding:nsutf8stringencoding]]; 

can advise, wrong in message?

you have lot of issues in soapmessage

1. <soapenv:envelope ..> closing tag </soap:envelope> 2. there no tag <xmlns:prod... these parameters of <soapenv:envelope.. 3. etc... (another mismatches) 

bottom line: make same working request

//put somewhere in code  nslog("%@",soapmessage); 

the copy , paste in file e.g. request.xml in terminal

xmllint --format request.xml 

and see if valid xml document


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -