之前没有用过webservice接口,前几天才刚开始研究。接口方法的参数是XML报文的字符串前几天soap返回的错误信息:<soap:Envelope 
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<soap:Fault>
<faultcode>
soap:Client
</faultcode>
<faultstring>
Invalid operation: {http://192.168.30.65:8080/}CMSaveForMoblie
</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>今天到公司后soap返回的值就变成了<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
  xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<soap:Fault>
<faultcode>
soap:Server
</faultcode>
<faultstring>
Could not read XML stream.. Nested exception is com.ctc.wstx.exc.WstxParsingException: Expected a text token, got START_ELEMENT. at [row,col {unknown-source}]: [1,367]
</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>问了服务器端,把报文发给他,他那边调用没有问题。
这周几乎一直在搞这个问题,求大神解决!!!我的调用代码- (void)uploadToWebServiceWithXML:(NSString *)xmlString{
    
    //  拼接soap字符串
    NSString *soapMsg=[NSString stringWithFormat:@"<?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/\" xmlns:ContentInfoService=\"http://xfire.ws.cm.com\">"
                       "<soap:Body>"
                       "<ContentInfoService:CMSaveForMobile xmlns=\"http://xfire.ws.cm.com\">"
                       "<ContentInfoService:in0>"
                       "%@"
                       "</ContentInfoService:in0>"
                       "</ContentInfoService:CMSaveForMobile>"
                       "</soap:Body>"
                       "</soap:Envelope>",xmlString
                       ];
    
    //  获取服务器URL
    NSURL *url=[NSURL URLWithString:@"http://192.168.30.66:8080/CM/services/ContentInfoService"];
    
    //  获取soap字符串的长度
    NSString *msgLength=[NSString stringWithFormat:@"%ld",[soapMsg length]];
    
    //  根据URL生成request
    NSMutableURLRequest *request=[NSMutableURLRequest requestWithURL:url];
    
    //  request的相关设置
    [request addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
    [request addValue: msgLength forHTTPHeaderField:@"Content-Length"];
    [request setHTTPMethod:@"POST"];
    [request setHTTPBody:[soapMsg dataUsingEncoding:NSUTF8StringEncoding]];
    [request addValue: @"http://192.168.30.66:8080/CM/services/ContentInfoService/CMSaveForMobile" forHTTPHeaderField:@"SOAPAction"];
    
    //  根据request进行连接,得到返回的数据
    NSData *data=[NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
    NSMutableString *result=[[NSMutableString alloc]initWithData:data encoding:NSUTF8StringEncoding];
    // NSLog(@"%@", xmlString);
    NSLog(@"结果--------------\n%@",result);}服务器的wsdl如下:<wsdl:definitions xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding" xmlns:tns="http://xfire.ws.cm.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" targetNamespace="http://xfire.ws.cm.com"><xsd:element name="CMSaveForMobile">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="in0" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element><wsdl:operation name="CMSaveForMobile">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="CMSaveForMobileRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="CMSaveForMobileResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ContentInfoService">
<wsdl:port name="ContentInfoServiceHttpPort" binding="tns:ContentInfoServiceHttpBinding">
<wsdlsoap:address location="http://192.168.30.66:8080/CM/services/ContentInfoService"/>
</wsdl:port>
</wsdl:service>