gpt4 book ai didi

java - 带有 http :binding 的 wsimport

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:10:01 25 4
gpt4 key购买 nike

我的 wsdl 中有以下绑定(bind)和服务元素:

<wsdl:binding name="MyServiceSOAP11Binding" type="impl:MyServicePortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="getProjects4Me">
<soap:operation soapAction="getProjects4Me" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>

<wsdl:binding name="MyServiceHttpBinding" type="impl:MyServicePortType">
<http:binding verb="POST"/>
<wsdl:operation name="getProjects4Me">
<http:operation location="MyService/getProjects4Me"/>
<wsdl:input>
<mime:content type="text/xml" part="getProjects4Me"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="getProjects4Me"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MyService">
<wsdl:port name="MyServiceSOAP11port_http" binding="impl:MyServiceSOAP11Binding">
<soap:address location="http://shop.my.com:80//services/MyService"/>
</wsdl:port>
<wsdl:port name="MyServiceHttpport" binding="impl:MyServiceHttpBinding">
<http:address location="http://shop.my.com:80/services/MyService"/>
</wsdl:port>
</wsdl:service>

当我在上述 wsdl 上使用 wsimport 时,它会为“MyServiceSOAP11port_http”生成代码,但不会为“MyServiceHttpport”生成代码。我错过了什么吗?

我的 wsimport ANT 任务:

  <target name="wsimport">
<exec executable="${jdk.home}/bin/wsimport">
<arg line="-keep -s ../wsimportsrc -p com.sample -verbose
-d ../wsimportclasses ../wsdl_xsd/MyService.xml"/>
</exec>
</target>

最佳答案

它确实产生了。你能检查一下 *_Service.java 文件吗?它们都共享相同的 QName,但有两个不同的端点。在你的情况下会有像

这样的代码
 http://www.example.org/NewWSDLFile --> Consider this as Your Name Space

@WebEndpoint(name = "MyServiceSOAP11port_http")
public NewWSDLFile getNewWSDLFileSOAP1() {
return super.getPort(new QName("http://www.example.org/NewWSDLFile/",
"MyServiceSOAP11port_http"), NewWSDLFile.class);
}

 @WebEndpoint(name = "MyServiceHttpport")
public NewWSDLFile getNewWSDLFileSOAP(WebServiceFeature... features) {
return super.getPort(new QName("http://www.example.org/NewWSDLFile/",
"MyServiceHttpport"), NewWSDLFile.class, features);
}

仅仅拥有两个端口并不意味着每个端口类型都有单独的代码库

关于java - 带有 http :binding 的 wsimport,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14950569/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com