Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/381.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 如何在没有wsdl的情况下创建Axis客户端';谁的网址?_Java_Web Services_Axis - Fatal编程技术网

Java 如何在没有wsdl的情况下创建Axis客户端';谁的网址?

Java 如何在没有wsdl的情况下创建Axis客户端';谁的网址?,java,web-services,axis,Java,Web Services,Axis,我想使用本地wsdl为web服务创建一个Axis客户端,而不知道wsdl的url。我在本教程中尝试了动态调用接口方法,但出现以下错误: AxisFault故障代码: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException faultSubcode:faultString:无客户端 找到名为“null”的传输! faultActor:faultNode:faultDetail: {http://xml.apache.or

我想使用本地wsdl为web服务创建一个Axis客户端,而不知道wsdl的url。我在本教程中尝试了动态调用接口方法,但出现以下错误:

AxisFault故障代码: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException faultSubcode:faultString:无客户端 找到名为“null”的传输! faultActor:faultNode:faultDetail: {http://xml.apache.org/axis/}斯塔克:没有 找到名为“null”的客户端传输! 在 org.apache.axis.client.AxisClient.invoke(AxisClient.java:170)

我的代码是:

        ServiceFactory factory = ServiceFactory.newInstance();
        Service service = factory.createService(new QName("http://j2ee.netbeans.org/wsdl/CompositionBpelModule/ComposedWebServiceService","ComposedWebServiceServiceService"));
        Call call = service.createCall();
        call.setPortTypeName(new QName("http://j2ee.netbeans.org/wsdl/CompositionBpelModule/ComposedWebServiceService","ComposedWebServiceServicePortType"));
        call.setProperty(Call.OPERATION_STYLE_PROPERTY, "wrapped");
        call.setProperty(Call.ENCODINGSTYLE_URI_PROPERTY, "");
        call.setReturnType(XMLType.XSD_STRING);
        call.setOperationName(new QName("http://j2ee.netbeans.org/wsdl/CompositionBpelModule/ComposedWebServiceService", "ComposedWebServiceServiceOperation"));
        call.addParameter("input1", XMLType.XSD_STRING, ParameterMode.IN);
        String[] params = {input};
        response = (String)call.invoke(params);

谢谢你

我和你有同样的问题。 挖了几个小时后,我似乎几乎解决了这个问题。 发生此异常是因为缺少设置目标终结点地址 这是我的密码

        Call call = service.createCall();
        call.setPortTypeName(portQName);
        call.setOperationName(new QName(namespace, operation));
        call.setProperty(Call.ENCODINGSTYLE_URI_PROPERTY, "http://schemas.xmlsoap.org/soap/encoding/"); 
        call.setProperty(Call.OPERATION_STYLE_PROPERTY, "rpc");
        call.addParameter("in0", org.apache.axis.Constants.XSD_STRING ,ParameterMode.IN);
        call.addParameter("in1", org.apache.axis.Constants.XSD_STRING ,ParameterMode.IN);
        call.setReturnType(serviceQName);
        String targetEndpoint = "http://113.160.19.218:8312/axis/services/WeatherForecastTest1";
        call.setTargetEndpointAddress(targetEndpoint);
        String result = (String) call.invoke(params);
        out.println(result);
targetEndpoint Agment的值是端口元素内address元素的location属性的值。这里有一个例子

<service name="WeatherForecastTest1Service">
    <port binding="impl:WeatherForecastTest1SoapBinding" name="WeatherForecastTest1">
      <wsdlsoap:address location="http://113.160.19.218:8312/axis/services/WeatherForecastTest1"/>
   </port>
  </service>

您可以通过使用某种wsdlParser检索wsdl文档来获得该值(我使用Axis的WSDL4J)(注意,在上面的代码示例中,我已经硬编码了targetEndpoint值)

此外,我将
OPERATION\u-STYLE\u-PROPERTY
设置为rpc-STYLE,将
ENCODINGSTYLE\u-URI\u-PROPERTY
设置为(这是默认值) 是我找到的解决这个问题的文件吗

希望对你有帮助!对不起,我的英语不好