我對SOAP很陌生,所以不介意我的愚蠢。 我有位於http://207.7.208.250:31361/SSI_MOBILE_PROD_INQiOS上的SOAP不起作用
WSDL SOAP Web服務是如下
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:intf="HTTP://207.7.208.250" targetNamespace="HTTP://207.7.208.250">
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:intf="HTTP://207.7.208.250" elementFormDefault="qualified" targetNamespace="HTTP://207.7.208.250">
<element name="ProductInquiryResponse">
<complexType>
<sequence>
<element name="EclipsePN" type="string"/>
<element name="Description" type="string"/>
<element name="AlternateDescription" type="string"/>
<element name="UPC" type="string"/>
<element name="Catalog" type="string"/>
<element name="PartNumber" type="string"/>
<element name="AvailQty" type="string"/>
<element name="AvailDate" type="string"/>
<element name="AvailUOM" type="string"/>
<element name="Price" type="string"/>
<element name="PriceUOM" type="string"/>
<element name="ImageURL" type="string"/>
<element name="SpecSheetURL" type="string"/>
<element name="ErrorDescription" type="string"/>
</sequence>
</complexType>
</element>
<element name="ProductInquiry">
<complexType>
<sequence>
<element name="Login" type="string"/>
<element name="Password" type="string"/>
<element name="EclipsePN" type="string"/>
<element name="UPC" type="string"/>
<element name="HomeBranch" type="string"/>
</sequence>
</complexType>
</element>
<element name="CALL_SSI_MOBILE_PROD_INQ">
<complexType>
<sequence>
<element ref="intf:ProductInquiry"/>
</sequence>
</complexType>
</element>
<element name="CALL_SSI_MOBILE_PROD_INQResponse">
<complexType>
<sequence>
<element ref="intf:ProductInquiryResponse"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="CALL_SSI_MOBILE_PROD_INQResponse">
<wsdl:part name="parameters" element="intf:CALL_SSI_MOBILE_PROD_INQResponse"></wsdl:part>
</wsdl:message>
<wsdl:message name="CALL_SSI_MOBILE_PROD_INQRequest">
<wsdl:part name="parameters" element="intf:CALL_SSI_MOBILE_PROD_INQ"></wsdl:part>
</wsdl:message>
<wsdl:portType name="SSI_MOBILE_PROD_INQ">
<wsdl:operation name="CALL_SSI_MOBILE_PROD_INQ">
<wsdl:input name="CALL_SSI_MOBILE_PROD_INQRequest" message="intf:CALL_SSI_MOBILE_PROD_INQRequest"></wsdl:input>
<wsdl:output name="CALL_SSI_MOBILE_PROD_INQResponse" message="intf:CALL_SSI_MOBILE_PROD_INQResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SSI_MOBILE_PROD_INQSOAPBinding" type="intf:SSI_MOBILE_PROD_INQ">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="CALL_SSI_MOBILE_PROD_INQ">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="CALL_SSI_MOBILE_PROD_INQRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="CALL_SSI_MOBILE_PROD_INQResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SSI_MOBILE_PROD_INQ">
<wsdl:port name="SSI_MOBILE_PROD_INQ" binding="intf:SSI_MOBILE_PROD_INQSOAPBinding">
<wsdlsoap:address location="HTTP://207.7.208.250:31361/SSI_MOBILE_PROD_INQ"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
這是我在做什麼來獲取... 我想在UPC代碼來發送和retrive的導致XML,然後我將解析和檢索數據。
NSMutableString *sRequest = [[NSMutableString alloc] init];
[sRequest appendString:@"<?xml version=\"1.0\" encoding=\"utf-8\"?>"];
[sRequest appendString:@"<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/\">"];
[sRequest appendString:@"<soap:Body>"];
[sRequest appendString:@"<SSI_MOBILE_PROD_INQ xmlns=\"http://207.7.208.250:31361/SSI_MOBILE_PROD_INQ/\">"];
[sRequest appendString:@"<CALL_SSI_MOBILE_PROD_INQ>"];
[sRequest appendString:@"<UPC>"];
[sRequest appendString:@"78285630648"];
[sRequest appendString:@"</UPC>"];
[sRequest appendString:@"</CALL_SSI_MOBILE_PROD_INQ>"];
[sRequest appendString:@"</SSI_MOBILE_PROD_INQ>"];
[sRequest appendString:@"</soap:Body>"];
[sRequest appendString:@"</soap:Envelope>"];
NSURL *weatherServiceURL = [NSURL URLWithString:@"http://207.7.208.250:31361/SSI_MOBILE_PROD_INQ"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:weatherServiceURL];
[request addValue:@"text/xml; charset:UTF-8" forHTTPHeaderField:@"Content-Type"];
[request addValue:@"http://207.7.208.250:31361/SSI_MOBILE_PROD_INQ" forHTTPHeaderField:@"SOAPAction"];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:[sRequest dataUsingEncoding:NSUTF8StringEncoding]];
NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self];
if (conn) {
myMutableData = [NSMutableData data];
NSLog(@"Conn is true");
}
[NSURLConnection connectionWithRequest:request delegate:self];
NSError *WSerror;
NSURLResponse *WSresponse;
NSData *returnData = (NSMutableData*)[NSURLConnection sendSynchronousRequest:request
returningResponse:&WSresponse error:&WSerror];
if(WSerror){
NSLog(@"%@", [WSerror localizedDescription]);
}
if (returnData) {
NSString *content = [NSString stringWithUTF8String:[myMutableData bytes]];
DebugLog(@"yeah %@", content);
}
我得不到內容字符串的輸出。 我想我沒有正確調用SOAP方法....? 你有什麼想法?
你嘗試過在這裏? http://sudzc.com/ – HeikoG 2012-02-15 15:12:42
是的,這是我第一次嘗試 它甚至沒有爲我生成可編譯的代碼.... – 2012-02-15 15:22:37
sudzc已經證明對我非常有效,你能提供一些你得到的問題的細節與sudzc代碼。並注意到有一個很少發生的問題,即將您的服務命名爲相同的密碼。導致文件覆蓋另一個,打破了SDK – 2012-02-15 16:21:38