user1583261
user1583261

Reputation: 137

wsdl has no service element

I have to consume a WCF web service and was given a WSDL (external, so have no control on the WSDL). Inside the WSDL definitions I am not finding the service element which has the service, port and address elements. Is that normal not be present in a WSDL? Is this common for a WCF WSDL? I am trying to generate stubs for this using axis and am having issues.

<wsdl:definitions>
....
...
..

**<wsdl:service>
      <wsdl:port>
       <wsdl1:address/>
      </wsdl:port>
    </wsdl:service>**

</wsdl:definitions>

The part between the asterisks is what is missing in the WSDL.

Did someone have an issue like this? Please let me know.

When generating stubs, I am getting this error: Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing WSDL at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerationEngine.java:175) at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35) at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24) Caused by: org.apache.axis2.AxisFault: No services found in the WSDL at file:/c:/work/xxx.wsdl with targetnamespace http://tempuri.org/ at org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder.populateAllServices(WSDL11ToAllAxisServicesBuilder.java:115) at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(CodeGenerationEngine.java:169) ... 2 more

I looked at the code WSDL11ToAllAxisServicesBuilder.java and it looks like this error occurs if axis does not find a service element.

Does anyone have a solution to this?

Upvotes: 4

Views: 11152

Answers (1)

user1583261
user1583261

Reputation: 137

I found why this WSDL was missing the service tag, the original WSDL provided had an import which has the service element. I don't know if it is a correct way to do it or not, but the endpoint give to me to consume did not have it, I had to dig into other imported WSDLs to see that one of them had the service element.

Hope this helps someone.

I could not use a wsdl2java on the WSDL since there was no endpoint, do not know how to tell axis to look into the imported WSDLs for the service element though.

Upvotes: 3

Related Questions