I'm programming a SOAP client for an existing soap web service. I'm using Wildfly8.2 as a server where the client is and JbossWS, JAX-WS
I generated the classes needed to call the service via eclispe with the NEW-> Web service client wizzard
When I call the service I got the error INVALID_WSDL ... the stack trace is on the bottom.
The actual problematic service call is the call to "addService" method of the web service.
This is the code that I use to call the service:
SOAP service1 = new SOAP();
WorkflowEditor workflowEditor = service1.getSOAPPort();
AddService parameters = new AddService();
parameters.setLogicalURI(logicalUri);
parameters.setServiceDescription(serviceDescription);
parameters.setServiceType(servicetype.getName());
Specialties specialities = new Specialties();
specialities.getSpecialty().add("aaaa");
parameters.setSpecialties(specialities);
parameters.setWsdlLocation(wsdlLocation);
parameters.setWsdlServiceName(wsdlServiceName);
parameters.setSessionToken(currentUser.getKeystoneSessionToken());
workflowEditor.addService(parameters);
the generated java class for the parameters in the soap call:
package si.arctur.services.workflowEditor;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
})
@XmlRootElement(name = "addService")
public class AddService {
@XmlElement(required = true)
protected String sessionToken;
@XmlElement(required = true)
protected String wsdlLocation;
@XmlElement(required = true)
protected String wsdlServiceName;
@XmlElement(required = true)
protected String logicalURI;
@XmlElement(required = true)
protected String serviceType;
protected AddService.Specialties specialties;
@XmlElement(required = true)
protected String serviceDescription;
public String getSessionToken() {
return sessionToken;
}
public void setSessionToken(String value) {
this.sessionToken = value;
}
public String getWsdlLocation() {
return wsdlLocation;
}
public void setWsdlLocation(String value) {
this.wsdlLocation = value;
}
public String getWsdlServiceName() {
return wsdlServiceName;
}
public void setWsdlServiceName(String value) {
this.wsdlServiceName = value;
}
public String getLogicalURI() {
return logicalURI;
}
public void setLogicalURI(String value) {
this.logicalURI = value;
}
public String getServiceType() {
return serviceType;
}
public void setServiceType(String value) {
this.serviceType = value;
}
public AddService.Specialties getSpecialties() {
return specialties;
}
public void setSpecialties(AddService.Specialties value) {
this.specialties = value;
}
public String getServiceDescription() {
return serviceDescription;
}
public void setServiceDescription(String value) {
this.serviceDescription = value;
}
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"specialty"
})
public static class Specialties {
@XmlElement(required = true)
protected List<String> specialty;
public List<String> getSpecialty() {
if (specialty == null) {
specialty = new ArrayList<String>();
}
return this.specialty;
}
}
}
This is the wsdl copied from the browser:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="WorkflowEditor" targetNamespace="*****************" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wfe="*****************" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:types>
<xsd:schema targetNamespace="*****************">
<xsd:element name="addService">
<xsd:complexType>
<xsd:all>
<xsd:element name="sessionToken" type="xsd:string"/>
<xsd:element name="wsdlLocation" type="xsd:string"/>
<xsd:element name="wsdlServiceName" type="xsd:string"/>
<xsd:element name="logicalURI" type="xsd:string"/>
<xsd:element name="serviceType" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="specialties">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="1" name="specialty" type="xsd:string">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="serviceDescription" type="xsd:string">
</xsd:element>
<xsd:element name="serviceTitle" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="addServiceResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="success" type="xsd:boolean"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="removeService">
<xsd:complexType>
<xsd:all>
<xsd:element name="sessionToken" type="xsd:string"/>
<xsd:element name="serviceURI" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="removeServiceResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="success" type="xsd:boolean"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="addUserToService">
<xsd:complexType>
<xsd:all>
<xsd:element name="sessionToken" type="xsd:string"/>
<xsd:element name="serviceURI" type="xsd:string"/>
<xsd:element name="username" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="addUserToServiceResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="success" type="xsd:boolean"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="removeUserFromService">
<xsd:complexType>
<xsd:all>
<xsd:element name="sessionToken" type="xsd:string"/>
<xsd:element name="serviceURI" type="xsd:string"/>
<xsd:element name="username" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="removeUserFromServiceResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="success" type="xsd:boolean"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="addWorkflow">
<xsd:complexType>
<xsd:all>
<xsd:element name="sessionToken" type="xsd:string"/>
<xsd:element name="workflowDescription_base64" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="addWorkflowResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="success" type="xsd:boolean"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="removeWorkflow">
<xsd:complexType>
<xsd:all>
<xsd:element name="sessionToken" type="xsd:string"/>
<xsd:element name="workflowURI" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="removeWorkflowResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="success" type="xsd:boolean"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="replaceWorkflow">
<xsd:complexType>
<xsd:all>
<xsd:element name="sessionToken" type="xsd:string"/>
<xsd:element name="workflowDescription_base64" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="replaceWorkflowResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="success" type="xsd:boolean"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getWorkflowDescription">
<xsd:complexType>
<xsd:all>
<xsd:element name="sessionToken" type="xsd:string"/>
<xsd:element name="workflowURI" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="getWorkflowDescriptionResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="success" type="xsd:boolean"/>
<xsd:element name="workflowDescription_base64" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getWorkflows">
<xsd:complexType>
<xsd:all>
<xsd:element name="sessionToken" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="getWorkflowsResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="success" type="xsd:boolean"/>
<xsd:element name="workflows">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="workflow" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getServices">
<xsd:complexType>
<xsd:all>
<xsd:element name="sessionToken" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="getServicesResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="success" type="xsd:boolean"/>
<xsd:element name="services">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="service" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getServiceIOs">
<xsd:complexType>
<xsd:all>
<xsd:element name="sessionToken" type="xsd:string"/>
<xsd:element name="serviceURI" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="getServiceIOsResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="success" type="xsd:boolean"/>
<xsd:element name="serviceIOs">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="serviceIO" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getServiceInfo">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="sessionToken" type="xsd:string"/>
<xsd:element name="serviceURI" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getServiceInfoResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="description" type="xsd:string"/>
<xsd:element name="wsdlLink" type="xsd:string"/>
<xsd:element name="title" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getServicesInfo">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="sessionToken" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getServicesInfoResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="success" type="xsd:boolean"/>
<xsd:element name="services">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="service">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="serviceURI" type="xsd:string">
</xsd:element>
<xsd:element maxOccurs="1" minOccurs="0" name="serviceDescription" type="xsd:string">
</xsd:element>
<xsd:element maxOccurs="1" minOccurs="1" name="serviceWSDL" type="xsd:string">
</xsd:element>
<xsd:element maxOccurs="1" minOccurs="1" name="serviceTitle" type="xsd:string">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="removeWorkflowRequest">
<wsdl:part name="parameters" element="wfe:removeWorkflow">
</wsdl:part>
</wsdl:message>
<wsdl:message name="addWorkflowRequest">
<wsdl:part name="parameters" element="wfe:addWorkflow">
</wsdl:part>
</wsdl:message>
<wsdl:message name="removeUserFromServiceRequest">
<wsdl:part name="parameters" element="wfe:removeUserFromService">
</wsdl:part>
</wsdl:message>
<wsdl:message name="removeServiceRequest">
<wsdl:part name="parameters" element="wfe:removeService">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getServicesRequest">
<wsdl:part name="parameters" element="wfe:getServices">
</wsdl:part>
</wsdl:message>
<wsdl:message name="removeUserFromServiceResponse">
<wsdl:part name="parameters" element="wfe:removeUserFromServiceResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="replaceWorkflowRequest">
<wsdl:part name="parameters" element="wfe:replaceWorkflow">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getServicesInfoRequest">
<wsdl:part name="parameters" element="wfe:getServicesInfo">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getWorkflowDescriptionRequest">
<wsdl:part name="parameters" element="wfe:getWorkflowDescription">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getServicesResponse">
<wsdl:part name="parameters" element="wfe:getServicesResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getServiceIOsResponse">
<wsdl:part name="parameters" element="wfe:getServiceIOsResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getServiceInfoResponse">
<wsdl:part name="parameters" element="wfe:getServiceInfoResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="addUserToServiceResponse">
<wsdl:part name="parameters" element="wfe:addUserToServiceResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="removeWorkflowResponse">
<wsdl:part name="parameters" element="wfe:removeWorkflowResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getWorkflowDescriptionResponse">
<wsdl:part name="parameters" element="wfe:getWorkflowDescriptionResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getServiceInfoRequest">
<wsdl:part name="parameters" element="wfe:getServiceInfo">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getWorkflowsResponse">
<wsdl:part name="parameters" element="wfe:getWorkflowsResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getServiceIOsRequest">
<wsdl:part name="parameters" element="wfe:getServiceIOs">
</wsdl:part>
</wsdl:message>
<wsdl:message name="replaceWorkflowResponse">
<wsdl:part name="parameters" element="wfe:replaceWorkflowResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="addServiceResponse">
<wsdl:part name="parameters" element="wfe:addServiceResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="addUserToServiceRequest">
<wsdl:part name="parameters" element="wfe:addUserToService">
</wsdl:part>
</wsdl:message>
<wsdl:message name="removeServiceResponse">
<wsdl:part name="parameters" element="wfe:removeServiceResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getServicesInfoResponse">
<wsdl:part name="parameters" element="wfe:getServicesInfoResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="addWorkflowResponse">
<wsdl:part name="parameters" element="wfe:addWorkflowResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getWorkflowsRequest">
<wsdl:part name="parameters" element="wfe:getWorkflows">
</wsdl:part>
</wsdl:message>
<wsdl:message name="addServiceRequest">
<wsdl:part name="parameters" element="wfe:addService">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="WorkflowEditor">
<wsdl:operation name="addService">
<wsdl:input message="wfe:addServiceRequest">
</wsdl:input>
<wsdl:output message="wfe:addServiceResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="removeService">
<wsdl:input message="wfe:removeServiceRequest">
</wsdl:input>
<wsdl:output message="wfe:removeServiceResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="addUserToService">
<wsdl:input message="wfe:addUserToServiceRequest">
</wsdl:input>
<wsdl:output message="wfe:addUserToServiceResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="removeUserFromService">
<wsdl:input message="wfe:removeUserFromServiceRequest">
</wsdl:input>
<wsdl:output message="wfe:removeUserFromServiceResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="addWorkflow">
<wsdl:input message="wfe:addWorkflowRequest">
</wsdl:input>
<wsdl:output message="wfe:addWorkflowResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="removeWorkflow">
<wsdl:input message="wfe:removeWorkflowRequest">
</wsdl:input>
<wsdl:output message="wfe:removeWorkflowResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="replaceWorkflow">
<wsdl:input message="wfe:replaceWorkflowRequest">
</wsdl:input>
<wsdl:output message="wfe:replaceWorkflowResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getWorkflowDescription">
<wsdl:input message="wfe:getWorkflowDescriptionRequest">
</wsdl:input>
<wsdl:output message="wfe:getWorkflowDescriptionResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getWorkflows">
<wsdl:input message="wfe:getWorkflowsRequest">
</wsdl:input>
<wsdl:output message="wfe:getWorkflowsResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getServices">
<wsdl:input message="wfe:getServicesRequest">
</wsdl:input>
<wsdl:output message="wfe:getServicesResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getServiceIOs">
<wsdl:input message="wfe:getServiceIOsRequest">
</wsdl:input>
<wsdl:output message="wfe:getServiceIOsResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getServiceInfo">
<wsdl:input message="wfe:getServiceInfoRequest">
</wsdl:input>
<wsdl:output message="wfe:getServiceInfoResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getServicesInfo">
<wsdl:input message="wfe:getServicesInfoRequest">
</wsdl:input>
<wsdl:output message="wfe:getServicesInfoResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="WorkflowEditorSOAP" type="wfe:WorkflowEditor">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="addService">
<soap:operation soapAction="*****************addService"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="removeService">
<soap:operation soapAction="*****************removeService"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="addUserToService">
<soap:operation soapAction="*****************addUserToService"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="removeUserFromService">
<soap:operation soapAction="*****************removeUserFromService"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="addWorkflow">
<soap:operation soapAction="*****************addWorkflow"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="removeWorkflow">
<soap:operation soapAction="*****************removeWorkflow"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="replaceWorkflow">
<soap:operation soapAction="*****************replaceWorkflow"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getWorkflowDescription">
<soap:operation soapAction="*****************getWorkflowDescription"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getWorkflows">
<soap:operation soapAction="*****************getWorkflows"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getServices">
<soap:operation soapAction="*****************getServices"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getServiceIOs">
<soap:operation soapAction="*****************getServiceIOs"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getServiceInfo">
<soap:operation soapAction="*****************getServiceInfo"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getServicesInfo">
<soap:operation soapAction="*****************getServicesInfo"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SOAP">
<wsdl:port name="SOAPPort" binding="wfe:WorkflowEditorSOAP">
<soap:address location="*******************************"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
The stack trace error:
Caused by: javax.wsdl.WSDLException: WSDLException (at /html): faultCode=INVALID_WSDL: Expected element '{http://schemas.xmlsoap.org/wsdl/}definitions'.
at com.ibm.wsdl.xml.WSDLReaderImpl.checkElementName(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at org.apache.axis2.description.AxisService.createClientSideAxisService(AxisService.java:2317)
... 29 more
Please try to create your service in this way:
SOAP service1 = new SOAP(new URL(yourURL));
But as yourURL
pass value with ?wsdl
at the end of the string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With