Emmanuel FOUCHE created CXF-5047:
------------------------------------
Summary: Wrong soap:address generated in WSDL
Key: CXF-5047
URL: https://issues.apache.org/jira/browse/CXF-5047
Project: CXF
Issue Type: Bug
Components: JAX-WS Runtime
Affects Versions: 2.7.0
Environment: WinXPsp3; Java-1.6.0_35; Tomcat-7.0.33
Reporter: Emmanuel FOUCHE
I am currently tweaking the DoubleItService tutorial described by Glen Mazza on
his Weblog http://www.jroller.com/gmazza/entry/web_service_tutorial.
I created test clients using generated classes using wsdl2java. Everything
works as intented.
Now I would like to expose the same service at two location.
Intended use is to filter access by requiring authentication at container level
on some url-pattern like /underquota/doubleit, while /services/doubleit default
remains accessible.
In WSDL, I added a second <wsdl:port> element
{code:xml}
<wsdl:service name="DoubleItService">
<wsdl:port name="DoubleItPort" binding="tns:DoubleItBinding">
<soap:address
location="http://localhost:8080/fr.efe4it.sample.webmodule.doubleitwsunderquota/services/doubleit"/>
</wsdl:port>
<wsdl:port name="DoubleItPortUnderquota" binding="tns:DoubleItBinding">
<soap:address
location="http://localhost:8080/fr.efe4it.sample.webmodule.doubleitwsunderquota/underquota/doubleit"/>
</wsdl:port>
</wsdl:service>
{code}
In cxf-servlet.xml, I declared 2 endpoints
{code:xml}
<jaxws:endpoint id="doubleit"
implementor="fr.efe4it.sample.webmodule.doubleitwsunderquota.DoubleItPortTypeImpl"
wsdlLocation="WEB-INF/wsdl/DoubleIt.wsdl"
address="/doubleit"
publishedEndpointUrl="http://localhost:8080/fr.efe4it.sample.webmodule.doubleitwsunderquota/services/doubleit"
/>
<jaxws:endpoint id="doubleitunderquota"
implementor="fr.efe4it.sample.webmodule.doubleitwsunderquota.DoubleItUnderQuotaPortTypeImpl"
wsdlLocation="WEB-INF/wsdl/DoubleIt.wsdl"
address="/underquota/doubleit"
publishedEndpointUrl="http://localhost:8080/fr.efe4it.sample.webmodule.doubleitwsunderquota/underquota/doubleit"
/>
{code}
The wsdl2java-generated classe DoubleItService now has 2 methods to retrieve
each portType
{code:java}
@WebEndpoint(name = "DoubleItPort")
public DoubleItPortType getDoubleItPort() {
return super.getPort(DoubleItPort, DoubleItPortType.class);
}
@WebEndpoint(name = "DoubleItPortUnderquota")
public DoubleItPortType getDoubleItPortUnderquota() {
return super.getPort(DoubleItPortUnderquota, DoubleItPortType.class);
}
{code}
I also have to implementors, attached to the corresponding portName. Below is
the one attached to the portName I added to the WSDL.
{code:java}
@WebService(targetNamespace = "http://www.example.org/contract/DoubleIt", //
portName = "DoubleItPortUnderquota", //
serviceName = "DoubleItService", //
endpointInterface = "org.example.contract.doubleit.DoubleItPortType")
@Features(features = "org.apache.cxf.feature.LoggingFeature")
public class DoubleItUnderQuotaPortTypeImpl implements DoubleItPortType {
...
{code}
When deploying the WAR under Tomcat, the call to
http://localhost:8080/myapp/services/ display the 2 deployed services with
correct URL.
||PortType||Operation||Detail||
|DoubleItPortType|DoubleIt|Endpoint address:
http://localhost:8080/fr.efe4it.sample.webmodule.doubleitwsunderquota/underquota/doubleit
WSDL : {http://www.example.org/contract/DoubleIt}DoubleItService
Target namespace: http://www.example.org/contract/DoubleIt|
|DoubleItPortType|DoubleIt|Endpoint address:
http://localhost:8080/fr.efe4it.sample.webmodule.doubleitwsunderquota/services/doubleit
WSDL : {http://www.example.org/contract/DoubleIt}DoubleItService
Target namespace: http://www.example.org/contract/DoubleIt|
Using SoapUI, I can succesfully run test queries against the 2 services.
However, when I request the WSDL in the browser, only one publishedEndpointUrl
corresponds to what I setup in cxf-servlet.xml.
{code:xml title=published WSDL}
<wsdl:service name="DoubleItService">
<wsdl:port binding="tns:DoubleItBinding" name="DoubleItPortUnderquota">
<soap:address location="/underquota/doubleit"/>
</wsdl:port>
<wsdl:port binding="tns:DoubleItBinding" name="DoubleItPort">
<soap:address
location="http://localhost:8080/fr.efe4it.sample.webmodule.doubleitwsunderquota/services/doubleit"/>
</wsdl:port>
</wsdl:service>
{code}
A the SOAP address, here /underquota/doubleit, retrieved from published WSDL is
the URL used by my java test code to invoke service operations, I get the
following error.
{code:java}
Caused by: javax.xml.ws.soap.SOAPFaultException: URI is not absolute
at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:156)
at $Proxy27.doubleIt(Unknown Source)
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira