Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/342.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 从webservices中的SOAP对象获取SOAP响应_Java_Soap - Fatal编程技术网

Java 从webservices中的SOAP对象获取SOAP响应

Java 从webservices中的SOAP对象获取SOAP响应,java,soap,Java,Soap,我的wsdl中的soap地址位置为“ 在我的web服务方法中,我有以下路径 @HttpResource(location="/{name}") 我想获取SOAP响应对象 我尝试了以下url http://localhost:8080/rpc/soap/helloworldsoap/abcd WSDL <?xml version='1.0' encoding='UTF-8'?> <wsdl:definitions name="HelloWorldImplService" ta

我的wsdl中的soap地址位置为

在我的web服务方法中,我有以下路径

@HttpResource(location="/{name}")
我想获取SOAP响应对象

我尝试了以下url

http://localhost:8080/rpc/soap/helloworldsoap/abcd

WSDL

<?xml version='1.0' encoding='UTF-8'?>

<wsdl:definitions name="HelloWorldImplService" targetNamespace="some name space" xmlns:ns1="http://test.com/webservices" xmlns:ns2="http://cxf.apache.org/bindings/xformat" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="some name space" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <wsdl:import location="http://localhost:8080/rpc/soap/helloworldsoap?wsdl=HelloWorld.wsdl" namespace="http://test.com/webservices">
    </wsdl:import>
  <wsdl:binding name="HelloWorldImplServiceSoapBinding" type="ns1:HelloWorld">
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="getHelloWorldAsString">
      <soap:operation soapAction="" style="rpc" />
      <wsdl:input name="getHelloWorldAsString">
        <soap:body namespace="http://test.com/webservices" use="literal" />
      </wsdl:input>
      <wsdl:output name="getHelloWorldAsStringResponse">
        <soap:body namespace="http://test.com/webservices" use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="HelloWorldImplService">
    <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding" name="HelloWorldImplPort">
      <soap:address location="http://localhost:8080/rpc/soap/helloworldsoap" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

肥皂:


soap:服务器
没有这样的操作:(HTTP GET PATH_INFO:/soap/helloworldsoap)
但是我没有得到响应对象

谁能告诉我如何做到这一点


提前谢谢。

您没有提供太多信息。但是试试看

telnet连接到本地主机8080,以查看服务是否正在运行


如果是,则使用命令行中的curl检查WSDL是否实际可用。

我不清楚是否可以使用SOAP的资源位置。至于其他方面,它是好的, 另外,由于您的错误,它在服务器端给出了关于位置的错误(您的输入保持良好)

试试这样的东西

删除资源位置,使用@WebMethod。

发布您的接口定义和SOAP输入

例如:

接口:

@WebService
public interface Service {

public Address validate(Address address);

@WebMethod
public String sayHi(
    @WebParam(mode = WebParam.Mode.IN)
    String msg);
}
实施:

package com.example;
导入javax.jws.WebService

@WebService(endpointInterface = "com.example.AddressService" )
public class AddressServiceImpl implements AddressService {

@Override
public Address validateAdress(Address address) {
     return  address;
    }

    @Override
    public String sayHi(String msg) {
        return "Vinay";
    }
}

希望这个例子有帮助

@Dave。。谢谢你的回复。该服务正在运行。添加wsdl和其他文件。请吃一顿好吗
@WebService(endpointInterface = "com.example.AddressService" )
public class AddressServiceImpl implements AddressService {

@Override
public Address validateAdress(Address address) {
     return  address;
    }

    @Override
    public String sayHi(String msg) {
        return "Vinay";
    }
}