That change works great, and does exactly what I need.  Thank you so much!



________________________________
From: Daniel Kulp <[email protected]>
To: [email protected]
Cc: Kevin McClusky <[email protected]>
Sent: Tuesday, April 19, 2011 12:10 PM
Subject: Re: Dynamic Client finding parameter classes for soap port


I'm not completely sure what's happening yet or why, but there is certainly an 
easy fix.   Change:

        DynamicClientFactory dcf = DynamicClientFactory.newInstance();

to 

        DynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();

The JAXWS subclass is much more capable as it can handle more of the complex 
use cases with headers and inouts and such.    

Dan


On Monday 18 April 2011 5:58:31 PM Kevin McClusky wrote:
> It looks like isUnwrapped() is false, so no dice on trying what you
> suggested. Here's a simple test case I threw together.  It's using a
> publicly available WSDL, found here:
> 
> 
> http://www.webservicex.net/stockquote.asmx?WSDL
> 
> 
> import javax.xml.namespace.QName;
> 
> import org.apache.cxf.endpoint.Client;
> import org.apache.cxf.endpoint.dynamic.DynamicClientFactory;
> import org.apache.cxf.service.model.MessagePartInfo;
> 
> public class SimpleTest {
> 
>     public static void main(String[] args) {
>         // WebserviceX Stock Quote
>         String wsdlUrl = "http://www.webservicex.net/stockquote.asmx?WSDL";;
>         QName service = new
> QName("http://www.webserviceX.NET/","StockQuote";); // SOAP port, doesn't
> have a type class
>         QName port = new
> QName("http://www.webserviceX.NET/","StockQuoteSoap12";); // POST port, has
> a type class
>         //QName port = new
> QName("http://www.webserviceX.NET/","StockQuoteHttpPost";); 
>         // Generate the SOAP client
>         DynamicClientFactory dcf = DynamicClientFactory.newInstance();
>         Client client = dcf.createClient(wsdlUrl, service,
> DynamicClientFactory.class.getClassLoader(), port); 
>         // Read and print the messagePartInfo
>         MessagePartInfo messagePartInfo =
> client.getEndpoint().getBinding().getBindingInfo().getOperations().iterato
> r().next().getInput().getMessageParts().get(0); printInfo(messagePartInfo);
>        
> 
>     }
>    
>     public static void printInfo(MessagePartInfo messagePartInfo) {
>         System.out.println("Message Part Name:
> "+messagePartInfo.getName()); System.out.println(" Type Name:  
> "+messagePartInfo.getTypeQName()); System.out.println(" Type Class:  
> "+messagePartInfo.getTypeClass()); System.out.println(" Element Name:
> "+messagePartInfo.getElementQName()); System.out.println("");
>     }
> 
> }
> 
> 
> The output when using the SOAP port above:
> 
> Message Part Name: {http://www.webserviceX.NET/}parameters
>  Type Name:    null
>  Type Class:   null
>  Element Name: {http://www.webserviceX.NET/}GetQuote
> 
> 
> And when using POST:
> 
> Message Part Name: {http://www.webserviceX.NET/}symbol
>  Type Name:    {http://www.w3.org/2001/XMLSchema}string
>  Type Class:   class java.lang.String
>  Element Name: null
> 
> 
> 
> 
> 
> ________________________________
> From: Daniel Kulp <[email protected]>
> To: [email protected]
> Cc: Kevin McClusky <[email protected]>
> Sent: Monday, April 18, 2011 1:30 PM
> Subject: Re: Dynamic Client finding parameter classes for soap port
> 
> On Monday 18 April 2011 4:22:18 PM Kevin McClusky wrote:
> > getTypeClass is actually giving me a null on any MessageParts that don't
> > have a type=
> 
> Strange.  That definitely should work fine as the class should be in
> there.  On the operation, can you try calling isUnwrapped and if true,
> casting it to the UnwrappedOperationInfo and try the message parts on the
> result of getWrappedOperation?
> 
> If that still doesn't help, we'd likely need to see a test case.   I'm
> really not sure why those classes are being set in there.
> 
> Dan
> 
> > -Kevin
> > 
> > 
> > 
> > ________________________________
> > From: Daniel Kulp <[email protected]>
> > To: [email protected]
> > Cc: Kevin McClusky <[email protected]>
> > Sent: Monday, April 18, 2011 1:00 PM
> > Subject: Re: Dynamic Client finding parameter classes for soap port
> > 
> > 
> > This all should work fine.    The getTypeClass should also be used in
> > this case and should return the required generated type for that
> > element.
> > 
> > Dan
> > 
> > On Friday 15 April 2011 11:33:59 PM Kevin McClusky wrote:
> > > Hi,
> > >
> > >    I have a WSDL that I'm trying to use with the Dynamic Client
> > >
> > > functionality of CXF.
> > >
> > >    I've been through this page (and ComplexClient.java), and it works
> > >great
> > >
> > > if my wsdl is using type for message parts.
> > > 
> > > http://cxf.apache.org/docs/dynamic-clients.html
> > >
> > >    Unfortunately, the WSDL is using messages like this:
> > >
> > >   <wsdl:message name="FillTankSoapIn">
> > >     <wsdl:part name="parameters" element="tns:FillTank" />
> > >   </wsdl:message>
> > >
> > >    I've been able to get the element QName with
> > >
> > > MessagePartInfo.getElementQName(), and I can see that the classes for
> > > the element are being generated, but I'm not sure how to go from the
> > > QName to the generated Class.
> > > 
> > > 
> > > (It appears there's no .getElementClass(), but I could just be missing
> > > something.)
> > >
> > >    Any help would be greatly appreciated.  I've been banging my head on
> > >the
> > >
> > > keyboard for a while now :)
> > > 
> > > Thanks,
> > > Kevin

-- 
Daniel Kulp
[email protected]
http://dankulp.com/blog
Talend - http://www.talend.com

Reply via email to