3

I have following binding and service elements in my wsdl:

<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>

When I use wsimport on the above wsdl, it does generate code for "MyServiceSOAP11port_http" but not for "MyServiceHttpport". Am I missing something?

My wsimport ANT task:

  <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>

1 Answers1

1

It does generate. Can you check the *_Service.java file. They both share the same QName but two different endpoints. In your case there would be code like

 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);
}

and

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

Simply having two ports would not mean separate code bases for each port type

user1428716
  • 2,078
  • 2
  • 18
  • 37
  • Not the first port type method is there in MyService.class but the second one corresponding to MyServiceHttpport which has binding type as http is not there. I even forcefully created a new method similar to SOAP binding port type method but got the following exception when running the client:Exception in thread "main" javax.xml.ws.WebServiceException: Unsupported endpoint address: at com.sun.xml.internal.ws.api.pipe.TransportTubeFactory.create(Unknown Source) – Piyush-Ask Any Difference Feb 19 '13 at 06:51
  • I didnt supply any extra option in wsimport still it got generated – user1428716 Feb 19 '13 at 07:10
  • Ok .. please keep the Correponding binding and portname same .. it should solve your problem .. – user1428716 Feb 19 '13 at 07:12