簡體   English   中英

帶有SOAP客戶端目標C的JAVA Web服務-響應問題

[英]JAVA Web Service with SOAP Client Objective C---Response problem

我在Java中有以下Web服務:

@WebService(serviceName = "Catalogo_V1")
public class Catalogo_V1 {

    /** This is a sample web service operation */
    @WebMethod(operationName = "hello")
    public String hello(@WebParam(name = "name") String txt) 
    {
        return "Hello " + txt + " !";
    }
}

和目標C中的這一部分(在使用WSDL2ObjC生成代碼之后):

- (IBAction)buttonPressed:(id)sender 
{

    Catalogo_V1PortBinding *binding = [[Catalogo_V1Svc Catalogo_V1PortBinding] initWithAddress:@"http://localhost:8080/WSServer/Catalogo_V1.wsdl"];
    binding.logXMLInOut = YES;  // to get logging to the console.

    Catalogo_V1Svc_hello *r = [[Catalogo_V1Svc_hello alloc] init];

    //NSLog(@"request: %@",r);

    [r setName:i.text];
    //NSLog(@"string: %@ ",i.text);

    Catalogo_V1PortBindingResponse *resp = [binding helloUsingParameters:(Catalogo_V1Svc_hello *)r];

    NSLog(@"response: %@",resp);

    for (id mine in resp.bodyParts)
    {
        if ([mine isKindOfClass:[Catalogo_V1Svc_helloResponse class]])
        {
            //lab.text = [mine Catalogo_V1Svc_helloResponse];
        }
    }
}

我的控制台顯示以下消息:

2

011-08-30 17:00:11.572 Catalogo-V1[3876:207] OutputHeaders:
{
    "Content-Length" = 451;
    "Content-Type" = "text/xml; charset=utf-8";
    Host = localhost;
    Soapaction = "";
    "User-Agent" = wsdl2objc;
}
2011-08-30 17:00:11.572 Catalogo-V1[3876:207] OutputBody:
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:Catalogo_V1Svc="http://org/" xsl:version="1.0">
  <soap:Body>
    <Catalogo_V1Svc:hello>
      <Catalogo_V1Svc:name>ddddddd</Catalogo_V1Svc:name>
    </Catalogo_V1Svc:hello>
  </soap:Body>
</soap:Envelope>
2011-08-30 17:00:11.593 Catalogo-V1[3876:207] Response HTTP:
<NSHTTPURLResponse: 0x5b1ffd0>
2011-08-30 17:00:11.593 Catalogo-V1[3876:207] ResponseStatus: 404
2011-08-30 17:00:11.593 Catalogo-V1[3876:207] ResponseHeaders:
{
    "Content-Length" = 1067;
    "Content-Type" = "text/html";
    Date = "Tue, 30 Aug 2011 15:00:11 GMT";
    Server = "GlassFish Server Open Source Edition 3.1.1";
    "X-Powered-By" = "Servlet/3.0 JSP/2.2 (GlassFish Server Open Source Edition 3.1.1 Java/Apple Inc./1.6)";
}
2011-08-30 17:00:11.617 Catalogo-V1[3876:207] ResponseError:
Error Domain=Catalogo_V1PortBindingResponseHTTP Code=404 "not found" UserInfo=0x5b2a320 {NSLocalizedDescription=not found}
2011-08-30 17:00:11.618 Catalogo-V1[3876:207] response: <Catalogo_V1PortBindingResponse: 0x5b25bd0>

輸出正確,但我沒有收到任何回應。

您的服務器以HTTP狀態404(未找到文件)響應,這意味着客戶端正在將其SOAP請求發布到未配置為響應的端點(URL)。

例如,您的客戶端可能被定向到http://localhost:8080/foo但是服務器正在偵聽http://localhost/bar

檢查客戶端和服務器配置上的端點URL,以確保它正在偵聽相同的URL。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM