wsdl-File not correctly deployed with JBoss 7.1.1
hd0815 Apr 19, 2012 8:12 AMHi again.
I wondered why soapUI generated wrong test requests for the web services I deploy on JBoss 7.1.1.Final. No parameters were offered.
Then I noticed that JBoss didn't deploy the wsdl-file correctly.
This is what I do to deloy the web service:
Annotate a class with the following:
{code}@WebService(endpointInterface = "foo.bar.WebserviceRemote",
name = "webservice",
portName = "webservicePort",
serviceName = "webserviceService",
targetNamespace = "http://example.org",
wsdlLocation = "META-INF/wsdl/webservice.wsdl"){code}
Put my webservice.wsdl into ejb.jar/META-INF/wsdl.
The wsdl file may look like this
{code:xml}<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="wsdl-viewer.xsl"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://example.org"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ns1="http://example.org/anotherDefinition"
name="webserviceService"
targetNamespace="http://example.org">
<wsdl:types>
<xsd:schema targetNamespace="http://example.org">
<xsd:import id="anotherDefinition.xsd" schemaLocation="./anotherDefinition.xsd"
namespace="http://example.org/anotherDefinition" />
<xsd:element name="getValue" type="tns:getValue" />
<xsd:element name="getValueResponse" type="tns:getValueResponse" />
<xsd:complexType name="getValue">
<xsd:sequence>
<xsd:element name="value" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="getValueResponse">
<xsd:sequence>
<xsd:element name="valueResponse" type="xsd:string"
minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="getValue">
<wsdl:part element="tns:getValue" name="parameters" />
</wsdl:message>
<wsdl:message name="getValueResponse">
<wsdl:part element="tns:getValueResponse"
name="parameters" />
</wsdl:message>
<wsdl:portType name="WebserviceRemote">
<wsdl:operation name="getValue">
<wsdl:input message="tns:getValue" />
<wsdl:output message="tns:getValueResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="webservicePortBinding" type="tns:WebserviceRemote">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="getValue">
<soap:operation soapAction="getValue" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="webserviceService">
<wsdl:port binding="tns:webservicePortBinding"
name="webservicePort">
<soap:address
location="http://localhost:8080/webserviceService/webservice" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>{code}
I'm not quite sure if this example wsdl file is working, I obscurified it a little, so maybe there are some errors. But that's not the point. Let's say my wsdl file worked in JBoss 7.0.
After deploying the ear file with the included ejb file containing the web service under META-INF/wsdl I get those log entries in server.log
{noformat}
11:55:56,692 INFO [org.jboss.wsf.stack.cxf.metadata.MetadataBuilder] (MSC service thread 1-1) Add Service
id=Webservice
address=http://localhost:8080/ejb/webserviceService/webservice
implementor=foo.bar.Webservice
invoker=org.jboss.wsf.stack.cxf.JBossWSInvoker
serviceName={http://example.org}webserviceService
portName={http://example.org}webservicePort
wsdlLocation=null
mtomEnabled=false
properties=[org.jboss.as.webservices.metadata.modelEjbComponentViewName -> service jboss.deployment.subunit."ear.ear"."ejb.jar".component.Webservice.VIEW."foo.bar.Webservice".SERVICE_ENDPOINT]
11:55:58,998 INFO [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-1) Creating Service {http://example.org}webserviceService from WSDL: META-INF/wsdl/webservice.wsdl
11:55:59,424 INFO [org.apache.cxf.endpoint.ServerImpl] (MSC service thread 1-1) Setting the server's publish address to be http://localhost:8080/ejb/webserviceService/webservice
11:55:59,440 INFO [org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher] (MSC service thread 1-1) WSDL published to: file:/C:/jboss/jboss-as-7.1.1.Final/standalone/data/wsdl/ear.ear/ejb.jar/webservice.wsdl{noformat}
When I try to access the wsdl file via http://localhost:8080/ejb/webserviceService/webservice?wsdl where it should be published according to server.log, I get the following result:
{code:xml}<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="wsdl-viewer.xsl"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://example.org"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ns1="http://example.org/anotherDefinition"
name="webserviceService"
targetNamespace="http://example.org">
<wsdl:types></wsdl:types>
<wsdl:message name="getValue">
<wsdl:part element="tns:getValue" name="parameters" />
</wsdl:message>
<wsdl:message name="getValueResponse">
<wsdl:part element="tns:getValueResponse"
name="parameters" />
</wsdl:message>
<wsdl:portType name="WebserviceRemote">
<wsdl:operation name="getValue">
<wsdl:input message="tns:getValue" />
<wsdl:output message="tns:getValueResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="webservicePortBinding" type="tns:WebserviceRemote">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="getValue">
<soap:operation soapAction="getValue" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="webserviceService">
<wsdl:port binding="tns:webservicePortBinding"
name="webservicePort">
<soap:address
location="http://localhost:8080/webserviceService/webservice" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>{code}
All definitions in <wsdl:types> tag disappeared. Calling file:/C:/jboss/jboss-as-7.1.1.Final/standalone/data/wsdl/ear.ear/ejb.jar/webservice.wsdl shows the correct wsdl file.
What am I missing?
I think I haven't changed seetings since moving from JBoss 7.0 to 7.1.1.Final. In JBoss 7.0 this webservice was deployed correctly.
As I mentioned already maybe this example isn't working properly, since I changed the example code without checking. I might create an example if there is no solution to this problem.