XPATH for retrieving element - web-services

I have this wsdl
<definitions targetNamespace="http://testwork/" name="HelloWorldService"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://testwork/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<types>
<xsd:schema>
<xsd:import namespace="http://soapServlet/" schemaLocation="http://localhost:8085/testwork/soapServlet?xsd=1"/>
</xsd:schema>
</types>
<message name="sayHelloWorldFrom">
<part name="parameters" element="tns:sayHelloWorldFrom"/>
</message>
<message name="sayHelloWorldFromResponse">
<part name="parameters" element="tns:sayHelloWorldFromResponse"/>
</message>
<message name="additionalFault">
<wsdl:part name="error" element="tns:responseFault"/>
</message>
<portType name="HelloWorld">
<operation name="sayHelloWorldFrom">
<input wsam:Action="http://testwork/HelloWorld/sayHelloWorldFromRequest" message="tns:sayHelloWorldFrom"/>
<output wsam:Action="http://testwork/HelloWorld/sayHelloWorldFromResponse" message="tns:sayHelloWorldFromResponse"/>
<wsdl:fault name="error" message="additionalFault"/>
</operation>
</portType>
<binding name="HelloWorldPortBinding" type="tns:HelloWorld">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="sayHelloWorldFrom">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="error">
<soap:fault name="error" use="literal"/>
</fault>
</operation>
</binding>
<service name="HelloWorldService">
<port name="HelloWorldPort" binding="tns:HelloWorldPortBinding">
<soap:address location="http://localhost:8085/testwork/soapServlet"/>
</port>
</service>
</definitions>
I want to check if this element "sayHelloWorldFrom" really exists in this schema. I use XPath for searching, this is my snippet of code
InputStream isr = IOUtils.toInputStream(wsdl);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(false);
try {
org.w3c.dom.Document doc = factory.newDocumentBuilder().parse(isr);
XPathFactory xFactory = XPathFactory.newInstance();
XPath xPath = xFactory.newXPath();
org.w3c.dom.Element element = (org.w3c.dom.Element) xPath.compile(
"definitions/portType/operation[#name='" + funcName +
"']").evaluate(doc, XPathConstants.NODE);
log.info("element " + element);
if (element == null) {
throw new ServiceException(ErrorCode.SOAP_EXCEPTION_005);
}
But the element == null for some reason, but I saw via debug that funcName is really sayHelloWorldFrom. Thus what is the problem?

I don't know why, but when I removed this part:
xmlns="http://schemas.xmlsoap.org/wsdl/"
xpath worked (maybe because xmlns means something for xml or xpath)
definitions/portType/operation[#name='sayHelloWorldFrom']
you can check it here http://www.xpathtester.com/obj/2403e210-fac4-4dd2-be63-69fcba8e0ac1

Related

How can I resolve the binding failed error in doing wsdl2java

I am trying to (re)generate code again from a preexisting WSDL. I am not able to use wsimport as it is giving binding failed error. So I tried WSDL validator from CXF. It gives this error. Please see below for my WSDL.
WSDLValidator Error :
Summary: Failures: 1, Warnings: 0
<<< ERROR!
Part <scheduledJob> in Message <{http://webservices.jobs.batch.prompt.com/}ImmJobWSIF_getScheduledJobResponse> referenced Type <{http://webservices.jobs.batch.prompt.com/}ScheduledJob> can not be found in the schemas
Here is the WSDL. Inline schema looks good comparing to some online schemas. I have no clue.
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="ImmJobWS"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
targetNamespace="http://webservices.jobs.batch.prompt.com/"
xmlns:tns="http://webservices.jobs.batch.prompt.com/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<types>
<xsd:schema elementFormDefault="qualified"
targetNamespace="http://webservices.jobs.batch.prompt.com/"
xmlns="http://webservices.jobs.batch.prompt.com/">
<xsd:element name="ScheduledJob">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="jobId" type="xsd:int"/>
<xsd:element name="jobName" type="xsd:string"/>
<xsd:element name="jobCategoryName" type="xsd:string"/>
<xsd:element name="jobClassName" type="xsd:string"/>
<xsd:element name="jobStatus" type="xsd:string"/>
<xsd:element name="nextExecutionDate" type="xsd:dateTime"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</types>
<message name="ImmJobWSIF_getScheduledJob">
<part name="job_id" type="xsd:int"/>
<part name="user_ident" type="xsd:string"/>
</message>
<message name="ImmJobWSIF_getScheduledJobResponse">
<part name="scheduledJob" type="tns:ScheduledJob"/>
</message>
<message name="ImmJobWSIF_startSched">
<part name="user_ident" type="xsd:string"/>
</message>
<message name="ImmJobWSIF_startSchedResponse">
<part name="result" type="xsd:string"/>
</message>
<message name="ImmJobWSIF_stopSched">
<part name="user_ident" type="xsd:string"/>
</message>
<message name="ImmJobWSIF_stopSchedResponse">
<part name="result" type="xsd:string"/>
</message>
<portType name="ImmJobWSIF">
<operation name="getScheduledJob" parameterOrder="job_id user_ident">
<input message="tns:ImmJobWSIF_getScheduledJob"/>
<output message="tns:ImmJobWSIF_getScheduledJobResponse"/>
</operation>
<operation name="startSched" parameterOrder="user_ident">
<input message="tns:ImmJobWSIF_startSched"/>
<output message="tns:ImmJobWSIF_startSchedResponse"/>
</operation>
<operation name="stopSched" parameterOrder="user_ident">
<input message="tns:ImmJobWSIF_stopSched"/>
<output message="tns:ImmJobWSIF_stopSchedResponse"/>
</operation>
</portType>
<binding name="ImmJobWSIFBinding" type="tns:ImmJobWSIF">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="rpc" />
<operation name="getScheduledJob">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" namespace="http://webservices.jobs.batch.prompt.com/" />
</input>
<output>
<soap:body use="literal" namespace="http://webservices.jobs.batch.prompt.com/" />
</output>
</operation>
<operation name="startSched">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" namespace="http://webservices.jobs.batch.prompt.com/" />
</input>
<output>
<soap:body use="literal" namespace="http://webservices.jobs.batch.prompt.com/" />
</output>
</operation>
<operation name="stopSched">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" namespace="http://webservices.jobs.batch.prompt.com/" />
</input>
<output>
<soap:body use="literal" namespace="http://webservices.jobs.batch.prompt.com/" />
</output>
</operation>
</binding>
<service name="ImmJobWS">
<port name="ImmJobWSIFPort" binding="tns:ImmJobWSIFBinding">
<soap:address location="http://vm-prover.maleri.com:8782/projImmJobs/ImmJobWS"/>
</port>
</service>
</definitions>

Only "hello" function working in my WSDL

Setting up a webservice on my Symfony server, I follow this guide:
https://symfony.com/doc/current/controller/soap_web_service.html
Example given is working well, with this hello fonction:
public function hello($name)
{
return 'Hello, '.$name;
}
So I've tried to complete this webservice with this bye function:
public function bye($name)
{
return 'Goodbye, '.$name;
}
And here is my wsdl:
<?xml version="1.0" encoding="ISO-8859-1"?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="urn:arnleadservicewsdl"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="urn:helloservicewsdl">
<types>
<xsd:schema targetNamespace="urn:hellowsdl">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
</xsd:schema>
</types>
<message name="helloRequest">
<part name="name" type="xsd:string" />
</message>
<message name="helloResponse">
<part name="return" type="xsd:string" />
</message>
<message name="byeRequest">
<part name="name" type="xsd:string" />
</message>
<message name="byeResponse">
<part name="return" type="xsd:string" />
</message>
<portType name="hellowsdlPortType">
<operation name="hello">
<documentation>Hello World</documentation>
<input message="tns:helloRequest"/>
<output message="tns:helloResponse"/>
</operation>
<operation name="bye">
<documentation>Goodbye World</documentation>
<input message="tns:byeRequest"/>
<output message="tns:byeResponse"/>
</operation>
</portType>
<binding name="hellowsdlBinding" type="tns:hellowsdlPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="hello">
<soap:operation soapAction="urn:arnleadservicewsdl#hello" style="rpc"/>
<input>
<soap:body use="encoded" namespace="urn:hellowsdl"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:hellowsdl"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="bye">
<soap:operation soapAction="urn:arnleadservicewsdl#bye" style="rpc"/>
<input>
<soap:body use="encoded" namespace="urn:hellowsdl"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:hellowsdl"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="hellowsdl">
<port name="hellowsdlPort" binding="tns:hellowsdlBinding">
<soap:address location="http://10.0.0.42/esi/soap" />
</port>
</service>
</definitions>
Hello function is still working, but each time i call bye function, I get an error:
Fatal error: Uncaught SoapFault exception: [Client] looks like we got no XML
Where am I wrong?
Ok, first I have rewritten my WSDL with help of https://www.wsdl-analyzer.com/. Here is my new WSDL:
<?xml version="1.0" encoding="ISO-8859-1"?>
<wsdl:definitions name="helloServiceController"
targetNamespace="urn:helloServiceControllerwsdl"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap = "http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="urn:helloServiceControllerwsdl">
<wsdl:types>
<xsd:schema targetNamespace="urn:helloServiceControllerwsdl">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
</xsd:schema>
</wsdl:types>
<wsdl:message name="helloRequest">
<wsdl:part name="name" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="helloResponse">
<wsdl:part name="return" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="byeRequest">
<wsdl:part name="name" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="byeResponse">
<wsdl:part name="return" type="xsd:string"/>
</wsdl:message>
<wsdl:portType name="helloServicePortType">
<wsdl:operation name="hello">
<wsdl:documentation>Hello World</wsdl:documentation>
<wsdl:input message="tns:helloRequest"/>
<wsdl:output message="tns:helloResponse"/>
</wsdl:operation>
<wsdl:operation name="bye">
<wsdl:documentation>Bye World</wsdl:documentation>
<wsdl:input message="tns:byeRequest"/>
<wsdl:output message="tns:byeResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="helloServiceBinding" type="tns:helloServicePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="hello">
<soap:operation soapAction="urn:helloServiceControllerwsdl#hello" style="rpc"/>
<wsdl:input>
<soap:body use="encoded" namespace="urn:helloServiceControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:input>
<wsdl:output>
<soap:body use="encoded" namespace="urn:helloServiceControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="bye">
<soap:operation soapAction="urn:helloServiceControllerwsdl#bye" style="rpc"/>
<wsdl:input>
<soap:body use="encoded" namespace="urn:helloServiceControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:input>
<wsdl:output>
<soap:body use="encoded" namespace="urn:helloServiceControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="helloService">
<wsdl:port name="helloServicePort" binding="tns:helloServiceBinding">
<soap:address location="http://10.0.0.42/esi/soap"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
After that, it was still not working and even hello function was not working. After pulling my hair for a while, I simply restarted my server and it was good. Probably a cache problem!

SOAPUI error: does not close tag

When starting a SOAPUI SOAP project (from my local computer) using the following URL (on a server in my own network):
http://myinternaldomainname/test2?wsdl
The following error occurs:
Error loading [http://myinternaldomainname/test2?wsdl]:
org.apache.xmlbeans.XmlException: org.apache.xmlbeans.XmlException:
error: does not close tag
The server is added to my hosts file:
192.168.2.1 myexampledomain
When I store the result of the WSDL page as a wsdl file, I can open the WSDL file as new SOAP project.
I used Zend\Soap\Autodiscovery to generate this WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://myexampledomain/test2" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" name="MySoapService" targetNamespace="http://myexampledomain/test2">
<types>
<xsd:schema targetNamespace="http://myexampledomain/test2"/>
</types>
<portType name="MySoapServicePort">
<operation name="method1">
<documentation>This method takes ...</documentation>
<input message="tns:method1In"/>
<output message="tns:method1Out"/>
</operation>
<operation name="method2">
<documentation>This method takes ...</documentation>
<input message="tns:method2In"/>
<output message="tns:method2Out"/>
</operation>
</portType>
<binding name="MySoapServiceBinding" type="tns:MySoapServicePort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="method1">
<soap:operation soapAction="http://myexampledomain/test2#method1"/>
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://myexampledomain/test2"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://myexampledomain/test2"/>
</output>
</operation>
<operation name="method2">
<soap:operation soapAction="http://myexampledomain/test2#method2"/>
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://myexampledomain/test2"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://myexampledomain/test2"/>
</output>
</operation>
</binding>
<service name="MySoapServiceService">
<port name="MySoapServicePort" binding="tns:MySoapServiceBinding">
<soap:address location="http://myexampledomain/test2"/>
</port>
</service>
<message name="method1In">
<part name="inputParam" type="xsd:int"/>
</message>
<message name="method1Out">
<part name="return" type="xsd:string"/>
</message>
<message name="method2In">
<part name="inputParam1" type="xsd:int"/>
<part name="inputParam2" type="xsd:string"/>
</message>
<message name="method2Out">
<part name="return" type="xsd:float"/>
</message>
</definitions>
In SOAPUI I tried proxy disabled/enabled/automatic
If someone ever encounters this problem, what worked for me was hitting CTRL + ALT + P and setting the Proxy Settings to None
Please disable proxy by using CTRL+ALT+P and disable system firewall. hopefully it will work.
The problem was caused because a login page prevented me to use the WSDL in SOAP UI.

java.lang.ClassCastException: org.jboss.ws.core.soap.TextImpl cannot be cast to javax.xml.soap.SOAPElement

I am working on IBM Sterling V 9.3. I have exposed an Service as JAX-WS web service using the steps provided in the knowledge center successfully on Jboss 4.2.3 app server. EAR file got deployed successfully and app server started fine. I could see the generated WSDL file for the web service.
When I tried to access the WSDL from soapUI tool (version 3.5.1), I am getting the following error in the response message. I searched for the same and found out that we should have following jars under JBOSS_HOME\lib\endorsed folder:
• jboss-saaj.jar
• jboss-jaxws.jar
• jboss-jaxrpc.jar
• jaxb-api-2.1.9.jar
• xercesImpl.jar
• xalan.jar
• serializer.jar
I have added above jars but still getting the same error. Can share the more details if required. Please help.
Error message:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<env:Fault>
<faultcode>env:Server</faultcode>
<faultstring>java.lang.ClassCastException: org.jboss.ws.core.soap.TextImpl cannot be cast to javax.xml.soap.SOAPElement</faultstring>
</env:Fault>
</env:Body>
</env:Envelope>
WSDL file:
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="SearsBeansService"
targetNamespace="http://webservices.sears.com/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://webservices.sears.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<types>
<xsd:schema>
<xsd:import
namespace="http://webservices.sears.com/documentation/SearsGetOrderListForWSCService/searsGetOrderListForWSCService/output" schemaLocation="SearsBeansService_schema1.xsd"/>
</xsd:schema>
<xsd:schema>
<xsd:import
namespace="http://webservices.sears.com/documentation/SearsGetOrderListForWSCService/searsGetOrderListForWSCService/input" schemaLocation="SearsBeansService_schema2.xsd"/>
</xsd:schema>
<xsd:schema>
<xsd:import
namespace="http://webservices.sears.com/documentation/SearsGetOrderDetailsForWSCService/searsGetOrderDetailsForWSCService/output" schemaLocation="SearsBeansService_schema3.xsd"/>
</xsd:schema>
<xsd:schema>
<xsd:import
namespace="http://webservices.sears.com/documentation/SearsGetOrderDetailsForWSCService/searsGetOrderDetailsForWSCService/input" schemaLocation="SearsBeansService_schema4.xsd"/>
</xsd:schema>
<xsd:schema>
<xsd:import namespace="http://webservices.sears.com/" schemaLocation="SearsBeansService_schema5.xsd"/>
</xsd:schema>
<xsd:schema>
<xsd:import
namespace="http://www.sterlingcommerce.com/documentation/types" schemaLocation="yfctype.xsd"/>
</xsd:schema>
</types>
<message name="searsGetOrderDetailsForWSCService">
<part element="tns:searsGetOrderDetailsForWSCService" name="parameters"/>
</message>
<message name="searsGetOrderDetailsForWSCServiceResponse">
<part element="tns:searsGetOrderDetailsForWSCServiceResponse" name="parameters"/>
</message>
<message name="XBeanWSException">
<part element="tns:XBeanWSException" name="fault"/>
</message>
<message name="searsGetOrderListForWSCService">
<part element="tns:searsGetOrderListForWSCService" name="parameters"/>
</message>
<message name="searsGetOrderListForWSCServiceResponse">
<part element="tns:searsGetOrderListForWSCServiceResponse" name="parameters"/>
</message>
<portType name="SearsBeans">
<operation name="searsGetOrderDetailsForWSCService">
<input message="tns:searsGetOrderDetailsForWSCService"/>
<output message="tns:searsGetOrderDetailsForWSCServiceResponse"/>
<fault message="tns:XBeanWSException" name="XBeanWSException"/>
</operation>
<operation name="searsGetOrderListForWSCService">
<input message="tns:searsGetOrderListForWSCService"/>
<output message="tns:searsGetOrderListForWSCServiceResponse"/>
<fault message="tns:XBeanWSException" name="XBeanWSException"/>
</operation>
</portType>
<binding name="SearsBeansPortBinding" type="tns:SearsBeans">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="searsGetOrderDetailsForWSCService">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="XBeanWSException">
<soap:fault name="XBeanWSException" use="literal"/>
</fault>
</operation>
<operation name="searsGetOrderListForWSCService">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="XBeanWSException">
<soap:fault name="XBeanWSException" use="literal"/>
</fault>
</operation>
</binding>
<service name="SearsBeansService">
<port binding="tns:SearsBeansPortBinding" name="SearsBeansPort">
<soap:address location="REPLACE_WITH_ACTUAL_URL"/>
</port>
</service>
</definitions>
I am able to resolve this issue. I had to remove all the white spaces, comments and question marks (?) from the request (if any).
After that it was working fine. I think, due to the white spaces in request, soapUI was treating it as some kind of request element/value and was unable to convert into SOAPElement.
Hope this would be helpful for others !
Under Request Properties, set "Strip whitespaces" to true. This must be done for each new request. I didn't find a way to set true by default.
Questions marks are placeholders for parameters that must be supplied in your request.

The wsdl is throwing an error when trying to generate the stub(WebService Client) from it

This is my wsdl:
definitions targetNamespace="http://sei.profile.employee.com/" name="SimpleEmployeeProfileService" xmlns="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://sei.profile.employee.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<types>
<xsd:schema>
<xsd:import namespace="http://sei.profile.employee.com/" schemaLocation="EmployeeProfile_schema1.xsd"/>
</xsd:schema>
</types>
<message name="getEmployeeDetails">
<part name="parameters" element="tns:getEmployeeDetails"/>
<part name="departmentId" element="tns:departmentId"/>
</message>
<message name="getEmployeeDetailsResponse">
<part name="result" element="tns:getEmployeeDetailsResponse"/>
</message>
<portType name="SimpleEmployeeProfileService">
<operation name="getEmployeeDetails" parameterOrder="parameters departmentId">
<input ns1:Action="http://sei.profile.employee.com/EmployeeProfile/getEmployeeDetailsRequest" message="tns:getEmployeeDetails" xmlns:ns1="http://www.w3.org/2007/05/addressing/metadata"/>
<output ns2:Action="http://sei.profile.employee.com/EmployeeProfile/getEmployeeDetailsResponse" message="tns:getEmployeeDetailsResponse" xmlns:ns2="http://www.w3.org/2007/05/addressing/metadata"/>
</operation>
</portType>
<binding name="SimpleEmployeeProfileServicePortBinding" type="tns:SimpleEmployeeProfileService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="getEmployeeDetails">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="SimpleEmployeeProfileService">
<port name="SimpleEmployeeProfileServicePort" binding="tns:SimpleEmployeeProfileServicePortBinding">
<soap:address location="http://localhost:8080/SimpleWebService/SimpleEmployeeProfileService"/>
</port>
</service>
</definitions>
This is the error:
the prefix "soap" for element "soap:binding" is not bound
I have checked the tags but I haven't found any mistakes so far. Any help would be appreciated. Thanks in advance.
I added the following to the definition tag "xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" and it resolved my issue......
I will still keep this question posted since it might help some other user.