Thank Dan for your feedback,

wsdl2java 2.0.2 generate the following classes with following annotation


@WebService(targetNamespace = "http://madcap.aol.com/2007/06";, name =
"MadcapPort")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface MadcapPort extends java.io.Serializable 
{
...
}
AND

@javax.jws.WebService(name = "MadcapPort", serviceName =
"MadcapService",
                      portName = "Madcap",
                      targetNamespace = "http://madcap.aol.com/2007/06";,

                      wsdlLocation =
"file:/C:/svnwork/reg/trunk/reg/reg-ws/ws-madcap/src/wsdl/madcap.wsdl" ,
                      endpointInterface =
"com.aol.madcap._2007._06.MadcapPort")
public class MadcapPortImpl implements MadcapPort
{
...
}

So per your suggestions I did first 

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
 
factory.setServiceClass(com.aol.madcap._2007._06.MadcapPort.class);
        factory.setAddress(getServiceURL());
 
factory.setWsdlURL("file:../webapps/rsp-websvc-3.0/WEB-INF/classes/META-
INF/wsdl/madcap.wsdl");
        MadcapPort port = (com.aol.madcap._2007._06.MadcapPort)
factory.create();

Cause setWsdlLocation() does not exists in the factory interface so I am
using setWsdlURL()

But got exception as follows

org.apache.cxf.service.factory.ServiceConstructionException: Could not
find definition for service
{http://madcap.aol.com/2007/06}MadcapPortService.
        at
org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:
114)
        at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildService
FromWSDL(ReflectionServiceFactoryBean.java:189)
        at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeSe
rviceModel(ReflectionServiceFactoryBean.java:246)
        at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(Refle
ctionServiceFactoryBean.java:136)
        at
org.apache.cxf.frontend.AbstractEndpointFactory.createEndpoint(AbstractE
ndpointFactory.java:83)
        at
org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:
50)
        at
org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactory
Bean.java:82)
        at
com.aol.reg.rsp.adapter.madcap.MADCAPAdapter.getService(MADCAPAdapter.ja
va:65)
        at
com.aol.reg.rsp.adapter.madcap.ExtServiceMADCAPImpl.nameSuggestionMADCAP
(ExtServiceMADCAPImpl.java:84)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Then I updated the code as follows

private static final QName QNAME_SERVICE_NAME = new
QName("http://madcap.aol.com/2007/06";, "MadcapService");
...


JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
 
factory.setServiceClass(com.aol.madcap._2007._06.MadcapPort.class);
        factory.setAddress(getServiceURL());
 
factory.setWsdlURL("file:../webapps/rsp-websvc-3.0/WEB-INF/classes/META-
INF/wsdl/madcap.wsdl");
        factory.setServiceName(QNAME_SERVICE_NAME);
        MadcapPort port = (com.aol.madcap._2007._06.MadcapPort)
factory.create();


But got java.lang.reflect.InvocationTargetException with details
java.lang.IncompatibleClassChangeError

Can u please help me in resolve above? Do I need to set any setting in
the factory?

Thanks in advance,
Hussam Jarada

-----Original Message-----
From: Daniel Kulp [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 05, 2007 5:23 PM
To: [email protected]
Cc: Jarada, Hussam
Subject: Re: Invalid namespace with CXF 2.0.2 wsdl2java


The problem is that wsdl2java generates JAX-WS compatible code, but you
are using the simple frontend (instead of the jax-ws frontend) without
specifying the wsdl. (just the service address)

Most likely, you would just need to change the :
new ClientProxyFactoryBean();
to
new JaxWsProxyFactoryBean();
and it may work fine.

Alternatively, you may be able to call factory.
factory.setWsdlLocation(....)
to specify the location of the wsdl so it can get the proper namespaces
and stuff out of there.

Dan 


On Thursday 04 October 2007, Jarada, Hussam wrote:
> Hi,
>
> I am using wsdl2java tool to generate client stub library for the 
> client as follows C:\Program Files\Apache Software 
> Foundation\apache-cxf-2.0.2-incubator\bin>wsdl2java.bat -d 
> C:\svnwork\reg\trunk\reg\reg-ws\ws-madcap\src\main\java -compile -all 
> -exsh true -verbose 
> C:\svnwork\reg\trunk\reg\reg-ws\ws-madcap\src\wsdl\madcap.wsdl
>
> then from my client side I am calling
> import org.apache.cxf.frontend.ClientProxyFactoryBean;
>
> import com.aol.madcap._2007._06.*;
>
> ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
>
> factory.setServiceClass(com.aol.madcap._2007._06.MadcapPort.class);
>
> factory.setAddress(getServiceURL());
>
> MadcapPort port = (com.aol.madcap._2007._06.MadcapPort)
> factory.create();
>
> Then invoke reserveLoginId
>
>
>
> From logging
>
> Oct 4, 2007 11:38:06 AM
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> buildServiceFromClass
> INFO: Creating Service {http://_06._2007.madcap.aol.com/}MadcapPort
> from class com.aol.madcap._2007._06.MadcapPort
> Oct 4, 2007 11:39:18 AM
> org.apache.cxf.interceptor.LoggingOutInterceptor$LoggingCallback
> onClose INFO: Outbound Message
> --------------------------------------
> <soap:Envelope
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";><soap:Body><res
>er veLoginId
> xmlns="http://_06._2007.madcap.aol.com/";><loginIdReservation
> xmlns:ns2="http://madc
> ap.aol.com/2007/06"
> reserveSeconds="5"><ns2:loginId><ns2:name>HussamJarada</ns2:name><ns2:
>do
> mainInfo><ns2:domain>aol.in</ns2:domain><ns2:bid>17</ns2:bid><ns2:lang
>-l ocale>en-in</ns2
>
> :lang-locale></ns2:domainInfo></ns2:loginId></loginIdReservation></res
> :er
>
> veLoginId></soap:Body></soap:Envelope>
> --------------------------------------
> Oct 4, 2007 11:39:19 AM
> org.apache.cxf.interceptor.LoggingInInterceptor handleMessage
> INFO: Inbound Message
> --------------------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?>  <SOAP-ENV:Envelope  
>xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema
> -instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema";
> xmlns:mc="http://madcap.aol.com/2006/10";><SOAP-ENV:Header/><SOAP-ENV:B
>od y><SOAP-ENV:Fault><SOAP-ENV:faultcode>SOAP-ENV:Sende
> r</SOAP-ENV:faultcode><SOAP-ENV:faultstring>Invalid
> namespace</SOAP-ENV:faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOA
>P- ENV:Envelope>
>
> --------------------------------------
>
> The backend server report invalid namespace cause in the soap body 
> reserveLoginId xmlns=http://_06._2007.madcap.aol.com/  at which it 
> should be xmlns:ns2="http://madc <http://madc/> ap.aol.com/2007/06"
>
> Can someone please help me in resolving this issue, I tried using 
> early Xfire 1.2.6, then CXF 2.0 then 2.0.1 all report issues related 
> to namespace.
>
> why CXF 2.0.2 wsdl2java generate a soap body with 
> xmlns="http://_06._2007.madcap.aol.com
> <http://_06._2007.madcap.aol.com/";><loginIdReservation>  ? since the 
> wsdl we have
>
> Do I have issue in my wsdl2java arugments or the way I invoke the web 
> service from the ClientProxyFactoryBean?
>
> targetNamespace=http://madcap.aol.com/2007/06
>
> Thanks in advance,
>
> Jarada



--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
[EMAIL PROTECTED]
http://www.dankulp.com/blog

Reply via email to