(Ibaction) Webservicexrequestpost :(ID) Sender {
//EncapsulationSoapRequest Message,BuildWebServicesRequest string
nsstring * soapmessage = [ nsstring stringwithformat :@" /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"
"<Test xmlns =/" http://jinlong.ctc.com/">/N"
"<Userid >%@ </userid>/N"
"</Test>/N"
"</Soap: Body>/N"
"</Soap: envelope>/N",@ "Jinlong"
];
Nsstring* Msglength = [Nsstring Stringwithformat:@ "% D", [SoapmessageLength];
//Set Request address
Nsurl* Url = [Nsurl Urlwithstring:@ "Http: // localhost: 8080/testwebservices/services/test"];
Nsmutableurlrequest* URLRequest = [Nsmutableurlrequest Requestwithurl: Url];
//Add request header file
[URLRequest addvalue : @" text/XML; charset = UTF-8 " forhttpheaderfield : @ "Content-Type" ];
[URLRequest addvalue : @ "http://service.xiva.com/login" forhttpheaderfield : @ "soapaction" ];
[URLRequestAddvalue: MsglengthForhttpheaderfield:@ "Content-Length"];
//Set Request Method
[URLRequestSethttpmethod:@ "Post"];
[URLRequestSethttpbody: [SoapmessageDatausingencoding:Nsutf8stringencoding];
Nsurlresponse* Reponse;
Nserror* Error =Nil;
//Accept returned data
Nsdata* Responsedata = [Nsurlconnection Sendsynchronousrequest: URLRequestReturningresponse: & ReponseError: & Error];
Nsmutablestring*
Result = [[Nsmutablestring Alloc]Initwithdata: ResponsedataEncoding:Nsutf8stringencoding];
Nslog(@ "Return string is ========>% @", Result );
}