Announcement Announcement Module
Collapse
No announcement yet.
Automatic WSDL Generation not working Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Automatic WSDL Generation not working

    I'm having problems with auto-generating WSDL from naming conventions in my .XSD file.
    I'm getting a WSDL with an empty "portType" generated.
    Code:
    <wsdl:portType name="NetworkProvision">
    </wsdl:portType>
    No operations are added to the portType, as you can see!

    All my messages names end with *Request or *Response

    I have this schema in /WEB-INF/Prov.xsd:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://prov.m2.testing.es/" xmlns:prov="http://prov.m2.testing.es/" elementFormDefault="qualified">
    
        <complexType name="CreateSubscriberServiceRequest">
        	<sequence>
        		<element name="WorkOrder" type="string"></element>
        		<element name="Subscriber" type="string"></element>
        		<element name="Service" type="string"></element>
        		<element name="ServiceClass" type="string"></element>
        		<element name="Customer" type="string"></element>
        	</sequence>
        </complexType>
        <complexType name="CreateCustomer">
        	<sequence>
        		<element name="CustomerId" type="string"></element>
        		<element name="CustomerName" type="string"></element>
        	</sequence>
        </complexType>
        <complexType name="ModifySubscriberServiceParametersRequest">
        	<sequence>
        		<element name="WorkOrder" type="string"></element>
        		<element name="Subscriber" type="string"></element>
        		<element name="Service" type="string"></element>
    	   		<element name="ServiceClass" type="string"></element>
        		<element name="Customer" type="string"></element>
        	</sequence>
        </complexType>
        
        <complexType name="ModifySubscriberServiceStatusRequest">
        	<sequence>
        		<element name="WorkOrder" type="string"></element>
        		<element name="Subscriber" type="string"></element>
        		<element name="Service" type="string"></element>
        		<element name="Action" type="prov:ActionType"></element>
        	</sequence>
        </complexType>
        
    
        <simpleType name="ActionType">
        	<restriction base="string">
        		<enumeration value="Enable"></enumeration>
        		<enumeration value="Disable"></enumeration>
        		<enumeration value="Block"></enumeration>
        		<enumeration value="Unblock"></enumeration>
        	</restriction>
        </simpleType>
    
        <complexType name="ModifyCustomerStatusRequest">
        	<sequence>
        		<element name="WorkOrder" type="string"></element>
        		<element name="Customer" type="string"></element>
        		<element name="Action" type="prov:ActionType"></element>
        	</sequence>
        </complexType>
    
        <complexType name="SubscriberServiceInfoResponse">
        	<sequence>
        		<element name="Id" type="int"></element>
        		<element name="Subscriber" type="string"></element>
        		<element name="Service" type="string"></element>
        		<element name="ServiceClass" type="string"></element>
        		<element name="Customer" type="string"></element>
        		<element name="Status" type="string"></element>
        	</sequence>
        </complexType>
    
        <complexType name="SubscriberServiceInfoRequest">
        	<sequence>
        		<element name="Subscriber" type="string"></element>
        		<element name="Service" type="string"></element>
        	</sequence>
        </complexType>
    </schema>
    and this bean defined:

    Code:
        <bean id="networkProvision" class="org.springframework.ws.wsdl.wsdl11.DynamicWsdl11Definition">
        	<property name="builder">
    			<bean class="org.springframework.ws.wsdl.wsdl11.builder.XsdBasedSoap11Wsdl4jDefinitionBuilder">
    				<property name="schema" value="/WEB-INF/Prov.xsd"/>
    				<property name="portTypeName" value="NetworkProvision"/>
    				<property name="locationUri" value="http://prov.m2.testing.es/ws/networkProvision/"/>
    				<property name="targetNamespace" value="http://prov.m2.testing.es/"/>
    			</bean>
    		</property>
    	</bean>
    But I'm getting the following WSDL, with an empty "portType" generated
    Code:
    <wsdl:portType name="NetworkProvision">
    </wsdl:portType>
    Here's the full WSDL
    Code:
    <?xml version="1.0" encoding="UTF-8"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:schema="http://prov.m2.testing.es/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://prov.m2.testing.es/">
      <wsdl:types>
        <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:prov="http://prov.m2.testing.es/" elementFormDefault="qualified" targetNamespace="http://prov.m2.testing.es/">
    
        <complexType name="CreateSubscriberServiceRequest">
        	<sequence>
        		<element name="WorkOrder" type="string"/>
        		<element name="Subscriber" type="string"/>
        		<element name="Service" type="string"/>
        		<element name="ServiceClass" type="string"/>
    
        		<element name="Customer" type="string"/>
        	</sequence>
        </complexType>
        <complexType name="CreateCustomer">
        	<sequence>
        		<element name="CustomerId" type="string"/>
        		<element name="CustomerName" type="string"/>
        	</sequence>
        </complexType>
    
        <complexType name="ModifySubscriberServiceParametersRequest">
        	<sequence>
        		<element name="WorkOrder" type="string"/>
        		<element name="Subscriber" type="string"/>
        		<element name="Service" type="string"/>
    	   		<element name="ServiceClass" type="string"/>
        		<element name="Customer" type="string"/>
        	</sequence>
        </complexType>
    
        
        <complexType name="ModifySubscriberServiceStatusRequest">
        	<sequence>
        		<element name="WorkOrder" type="string"/>
        		<element name="Subscriber" type="string"/>
        		<element name="Service" type="string"/>
        		<element name="Action" type="prov:ActionType"/>
        	</sequence>
        </complexType>
        
    
        <simpleType name="ActionType">
    
        	<restriction base="string">
        		<enumeration value="Enable"/>
        		<enumeration value="Disable"/>
        		<enumeration value="Block"/>
        		<enumeration value="Unblock"/>
        	</restriction>
        </simpleType>
    
        <complexType name="ModifyCustomerStatusRequest">
    
        	<sequence>
        		<element name="WorkOrder" type="string"/>
        		<element name="Customer" type="string"/>
        		<element name="Action" type="prov:ActionType"/>
        	</sequence>
        </complexType>
    
        <complexType name="SubscriberServiceInfoResponse">
        	<sequence>
    
        		<element name="Id" type="int"/>
        		<element name="Subscriber" type="string"/>
        		<element name="Service" type="string"/>
        		<element name="ServiceClass" type="string"/>
        		<element name="Customer" type="string"/>
        		<element name="Status" type="string"/>
        	</sequence>
        </complexType>
    
        <complexType name="SubscriberServiceInfoRequest">
        	<sequence>
        		<element name="Subscriber" type="string"/>
        		<element name="Service" type="string"/>
        	</sequence>
        </complexType>
    </schema>
      </wsdl:types>
      <wsdl:portType name="NetworkProvision">
    
      </wsdl:portType>
      <wsdl:binding name="NetworkProvisionBinding" type="schema:NetworkProvision">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
      </wsdl:binding>
      <wsdl:service name="NetworkProvisionService">
        <wsdl:port binding="schema:NetworkProvisionBinding" name="NetworkProvisionPort">
          <soap:address location="http://localhost:8080/ws/networkProvision/"/>
        </wsdl:port>
      </wsdl:service>
    
    </wsdl:definitions>

  • #2
    I am having similar problems when trying to do a WSDL based on a large industry based schema. I'll be posting my own question here soon.

    I'm not sure if this will help but I noticed that there are no stand-alone elemens defined in the schema section. Have you tried adding an element definition for each Request/Response message as shown below?

    Code:
        <element name="CreateSubscriberServiceRequest" type="CreateSubscriberServiceRequestType" />
    
        <complexType name="CreateSubscriberServiceRequestType">
        	<sequence>
        		<element name="WorkOrder" type="string"/>
        		<element name="Subscriber" type="string"/>
        		<element name="Service" type="string"/>
        		<element name="ServiceClass" type="string"/>
    
        		<element name="Customer" type="string"/>
        	</sequence>
        </complexType>
    Last edited by Arjen Poutsma; May 31st, 2007, 05:05 AM. Reason: Added [code] tags

    Comment


    • #3
      OK!

      You're right, I don't think I was doing it correctly.
      Now I have the following schema,
      Code:
      <?xml version="1.0" encoding="UTF-8"?>
      <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://prov.m2.testing.es/" xmlns:prov="http://prov.m2.testing.es/" elementFormDefault="qualified">
      
          <complexType name="CreateSubscriberServiceRequestType">
          	<sequence>
          		<element name="WorkOrder" type="string"></element>
          		<element name="Subscriber" type="string"></element>
          		<element name="Service" type="string"></element>
          		<element name="ServiceClass" type="string"></element>
          		<element name="Customer" type="string"></element>
          	</sequence>
      ...
          </complexType>
          <element name="CreateCustomerRequest" type="prov:CreateCustomerRequestType"></element>
      ...
      
      </schema>
      And the following WSDL: note that the soapAction attributes are empty!
      Code:
      <?xml version="1.0" encoding="UTF-8"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:schema="http://prov.m2.testing.es/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://prov.m2.testing.es/">
        <wsdl:types>
          <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:prov="http://prov.m2.testing.es/" elementFormDefault="qualified" targetNamespace="http://prov.m2.testing.es/">
      
          <complexType name="CreateSubscriberServiceRequestType">
          	<sequence>
          		<element name="WorkOrder" type="string"/>
          		<element name="Subscriber" type="string"/>
          		<element name="Service" type="string"/>
          		<element name="ServiceClass" type="string"/>
      
          		<element name="Customer" type="string"/>
          	</sequence>
          </complexType>
          <complexType name="CreateCustomerRequestType">
          	<sequence>
          		<element name="CustomerId" type="string"/>
          		<element name="CustomerName" type="string"/>
          	</sequence>
          </complexType>
      
          <complexType name="ModifySubscriberServiceParametersRequestType">
          	<sequence>
          		<element name="WorkOrder" type="string"/>
          		<element name="Subscriber" type="string"/>
          		<element name="Service" type="string"/>
      	   		<element name="ServiceClass" type="string"/>
          		<element name="Customer" type="string"/>
          	</sequence>
          </complexType>
      
          
          <complexType name="ModifySubscriberServiceStatusRequestType">
          	<sequence>
          		<element name="WorkOrder" type="string"/>
          		<element name="Subscriber" type="string"/>
          		<element name="Service" type="string"/>
          		<element name="Action" type="prov:ActionType"/>
          	</sequence>
          </complexType>
          
      
          <simpleType name="ActionType">
      
          	<restriction base="string">
          		<enumeration value="Enable"/>
          		<enumeration value="Disable"/>
          		<enumeration value="Block"/>
          		<enumeration value="Unblock"/>
          	</restriction>
          </simpleType>
      
          <complexType name="ModifyCustomerStatusRequestType">
      
          	<sequence>
          		<element name="WorkOrder" type="string"/>
          		<element name="Customer" type="string"/>
          		<element name="Action" type="prov:ActionType"/>
          	</sequence>
          </complexType>
      
          <complexType name="SubscriberServiceInfoResponseType">
          	<sequence>
      
          		<element name="Id" type="int"/>
          		<element name="Subscriber" type="string"/>
          		<element name="Service" type="string"/>
          		<element name="ServiceClass" type="string"/>
          		<element name="Customer" type="string"/>
          		<element name="Status" type="string"/>
          	</sequence>
          </complexType>
      
          <complexType name="SubscriberServiceInfoRequestType">
          	<sequence>
          		<element name="Subscriber" type="string"/>
          		<element name="Service" type="string"/>
          	</sequence>
          </complexType>
      
          <element name="CreateCustomerRequest" type="prov:CreateCustomerRequestType"/>
          <element name="CreateSubscriberServiceRequest" type="prov:CreateSubscriberServiceRequestType"/>
      
          <element name="ModifyCustomerStatusRequest" type="prov:ModifyCustomerStatusRequestType"/>
          <element name="ModifySubscriberServiceParametersRequest" type="prov:ModifySubscriberServiceParametersRequestType"/>
          <element name="ModifySubscriberServiceStatusRequest" type="prov:ModifySubscriberServiceStatusRequestType"/>
          <element name="SubscriberServiceInfoRequest" type="prov:SubscriberServiceInfoRequestType"/>
          <element name="SubscriberServiceInfoResponse" type="prov:SubscriberServiceInfoResponseType"/>
      </schema>
        </wsdl:types>
        <wsdl:message name="CreateSubscriberServiceRequest">
          <wsdl:part element="schema:CreateSubscriberServiceRequest" name="CreateSubscriberServiceRequest">
      
          </wsdl:part>
        </wsdl:message>
        <wsdl:message name="CreateCustomerRequest">
          <wsdl:part element="schema:CreateCustomerRequest" name="CreateCustomerRequest">
          </wsdl:part>
        </wsdl:message>
        <wsdl:message name="SubscriberServiceInfoResponse">
          <wsdl:part element="schema:SubscriberServiceInfoResponse" name="SubscriberServiceInfoResponse">
          </wsdl:part>
      
        </wsdl:message>
        <wsdl:message name="ModifySubscriberServiceParametersRequest">
          <wsdl:part element="schema:ModifySubscriberServiceParametersRequest" name="ModifySubscriberServiceParametersRequest">
          </wsdl:part>
        </wsdl:message>
        <wsdl:message name="SubscriberServiceInfoRequest">
          <wsdl:part element="schema:SubscriberServiceInfoRequest" name="SubscriberServiceInfoRequest">
          </wsdl:part>
        </wsdl:message>
      
        <wsdl:message name="ModifySubscriberServiceStatusRequest">
          <wsdl:part element="schema:ModifySubscriberServiceStatusRequest" name="ModifySubscriberServiceStatusRequest">
          </wsdl:part>
        </wsdl:message>
        <wsdl:message name="ModifyCustomerStatusRequest">
          <wsdl:part element="schema:ModifyCustomerStatusRequest" name="ModifyCustomerStatusRequest">
          </wsdl:part>
        </wsdl:message>
        <wsdl:portType name="NetworkProvision">
      
          <wsdl:operation name="CreateSubscriberService">
            <wsdl:input message="schema:CreateSubscriberServiceRequest" name="CreateSubscriberServiceRequest">
          </wsdl:input>
          </wsdl:operation>
          <wsdl:operation name="CreateCustomer">
            <wsdl:input message="schema:CreateCustomerRequest" name="CreateCustomerRequest">
          </wsdl:input>
          </wsdl:operation>
          <wsdl:operation name="ModifySubscriberServiceParameters">
      
            <wsdl:input message="schema:ModifySubscriberServiceParametersRequest" name="ModifySubscriberServiceParametersRequest">
          </wsdl:input>
          </wsdl:operation>
          <wsdl:operation name="SubscriberServiceInfo">
            <wsdl:input message="schema:SubscriberServiceInfoRequest" name="SubscriberServiceInfoRequest">
          </wsdl:input>
            <wsdl:output message="schema:SubscriberServiceInfoResponse" name="SubscriberServiceInfoResponse">
          </wsdl:output>
          </wsdl:operation>
      
          <wsdl:operation name="ModifySubscriberServiceStatus">
            <wsdl:input message="schema:ModifySubscriberServiceStatusRequest" name="ModifySubscriberServiceStatusRequest">
          </wsdl:input>
          </wsdl:operation>
          <wsdl:operation name="ModifyCustomerStatus">
            <wsdl:input message="schema:ModifyCustomerStatusRequest" name="ModifyCustomerStatusRequest">
          </wsdl:input>
          </wsdl:operation>
        </wsdl:portType>
      
        <wsdl:binding name="NetworkProvisionBinding" type="schema:NetworkProvision">
          <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
          <wsdl:operation name="CreateSubscriberService">
            <soap:operation soapAction=""/>
            <wsdl:input name="CreateSubscriberServiceRequest">
              <soap:body use="literal"/>
            </wsdl:input>
          </wsdl:operation>
          <wsdl:operation name="CreateCustomer">
      
            <soap:operation soapAction=""/>
            <wsdl:input name="CreateCustomerRequest">
              <soap:body use="literal"/>
            </wsdl:input>
          </wsdl:operation>
          <wsdl:operation name="ModifySubscriberServiceParameters">
            <soap:operation soapAction=""/>
            <wsdl:input name="ModifySubscriberServiceParametersRequest">
              <soap:body use="literal"/>
      
            </wsdl:input>
          </wsdl:operation>
          <wsdl:operation name="SubscriberServiceInfo">
            <soap:operation soapAction=""/>
            <wsdl:input name="SubscriberServiceInfoRequest">
              <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="SubscriberServiceInfoResponse">
              <soap:body use="literal"/>
      
            </wsdl:output>
          </wsdl:operation>
          <wsdl:operation name="ModifySubscriberServiceStatus">
            <soap:operation soapAction=""/>
            <wsdl:input name="ModifySubscriberServiceStatusRequest">
              <soap:body use="literal"/>
            </wsdl:input>
          </wsdl:operation>
          <wsdl:operation name="ModifyCustomerStatus">
      
            <soap:operation soapAction=""/>
            <wsdl:input name="ModifyCustomerStatusRequest">
              <soap:body use="literal"/>
            </wsdl:input>
          </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="NetworkProvisionService">
          <wsdl:port binding="schema:NetworkProvisionBinding" name="NetworkProvisionPort">
            <soap:address location="http://localhost:8080/ws/networkProvision/"/>
      
          </wsdl:port>
        </wsdl:service>
      </wsdl:definitions>
      Is this the same error you have?
      What are these "soapAction" for? do I really need them?


      Thanks a lot!

      Comment


      • #4
        I still cannot get past the empty porttype error.

        I am not sure about the soapAction and why they are empty.

        My problem is that I have some kind of namespace conflict because I am using someone else's (multiple) schema files for the same namespace.

        Good luck

        Comment


        • #5
          You have not defined any element in the WSDL, hence no messages. You need to create elements for the *Request and *Reponse elements.

          Comment


          • #6
            Thanks Arjen,

            I added custom elements to the schema included in the WSDL naming them with the suffixes "Request" and "Response" and I got a proper WSDL now.

            If it didn't have "Request" at the end of an element it was not showing up as a message on the WSDL.

            Thanks again for your help.

            Comment


            • #7
              WSDL Issue - follow up

              I just noticed that on my WSDL and the one posted in this thread that the operation element did not have the output message declared.

              I'm not sure what is missing to show the output message.

              Comment


              • #8
                What are these "soapAction" for? do I really need them?
                The soapActions are not necessary, but they should be there (i.e. an empty attribute, such as the builder creates). If you want different behavior, you can override populateSoapOperation(), and set the soap action yourself.

                Comment


                • #9
                  Originally posted by carcovich View Post
                  I just noticed that on my WSDL and the one posted in this thread that the operation element did not have the output message declared.

                  I'm not sure what is missing to show the output message.
                  You mentioned that you have an industry based schema. It could be that the schema is too complex for the XsdBasedSoap11Wsdl4jDefinitionBuilder. This builder is only meant for relatively simple schema's. It has a relatively simple algorithm: it iterates over all elements found in the schema, and creates a message for those elements that end with the request or response suffix. It then combines these messages into operations, and builds a portType based on the operations. The schema itself is inlined in a types block.

                  If the schema is too complex, you could write your own WSDL, and use the SimpleWsdl11Definition to expose it.
                  Last edited by Arjen Poutsma; May 31st, 2007, 02:28 PM.

                  Comment


                  • #10
                    Originally posted by Arjen Poutsma View Post
                    You mentioned that you have an industry based schema. It could be that the schema is too complex for the XsdBasedSoap11Wsdl4jDefinitionBuilder. This builder is only meant for relatively simple schema's. It has a relatively simple algorithm: it iterates over all elements found in the schema, and creates a message for those elements that end with the request or response suffix. It then combines these messages into operations, and builds a portType based on the operations. The schema itself is inlined in a types block.

                    If the schema is too complex, you could write your own schema, and use the SimpleWsdl11Definition to expose it.
                    Hi Arjen

                    It works now, thanks for responding. My schema had two "includes" for the industry based schema and two elements: BackgroundCheckRequest and BackgroundReportResponse. I changed the name to BackgroundCheckResponse and the operation output name now appears.

                    Comment


                    • #11
                      Hi,

                      I had a very similar problem and this thread has helped greatly.

                      it seems that the element you have in your xsd schema must end in ***Request. I was just doing a simple example that had only one definition in the xsd. I had called it String but once renamed to StringRequest the wsdl was generated with the correct operation and message definitions. Not usre if it says that in the tutorials or doc, be these types of things must be clearly documented to save hours of frustration.

                      Thanks carcovich and Arjen Poutsma.

                      John.

                      Comment

                      Working...
                      X