cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elhanan <Elhan...@fnx.co.il>
Subject Re: cxf's dynamic proxies ?
Date Mon, 12 Jan 2009 13:48:22 GMT

ok, here's the thing

i tried wsdl2java, can't use that becouse it always requiries i will have a
generated client classs

tried dispatch method like so (with te wsdl i enclosed earlier):

		String
wsdl="http://btst3/UnderWrite.Biztalk.Proxy/Phoenix_ESB_UnderWrite_Biztalk_AgentDetails_4405_AgentDetails_Prt.asmx?WSDL";
		GetAgentDetails parameters=new GetAgentDetails();
		final AgentWSRequest agentWSRequest = new AgentWSRequest();
		agentWSRequest.setAgentNumber(8888);
		parameters.setPart(agentWSRequest);
		
		URL url =new
URL("http://btst3/UnderWrite.Biztalk.Proxy/Phoenix_ESB_UnderWrite_Biztalk_AgentDetails_4405_AgentDetails_Prt.asmx?WSDL");
		QName q=new
QName("http://Phoenix.co.il/UnderWrite","Phoenix_ESB_UnderWrite_Biztalk_AgentDetails_4405_AgentDetails_Prt");
	
		final Service service= Service.create(url, q);
		QName port=new
QName("http://Phoenix.co.il/UnderWrite","Phoenix_ESB_UnderWrite_Biztalk_AgentDetails_4405_AgentDetails_Prt");
		service.addPort(port,"http://schemas.xmlsoap.org/soap/",
"http://btst3/UnderWrite.Biztalk.Proxy/Phoenix_ESB_UnderWrite_Biztalk_AgentDetails_4405_AgentDetails_Prt.asmx");
						
		JAXBContext ctx = JAXBContext.newInstance(ObjectFactory.class);		
		final Dispatch createDispatch = service.createDispatch(q, ctx,
Service.Mode.MESSAGE);
		
		final Object invoke = createDispatch.invoke(parameters);
		System.out.println(invoke);

but i got: Error setting the source for SOAPPart: null

i also tried using 


		DynamicClientFactory newInstance = DynamicClientFactory.newInstance();
		final ClassLoader contextClassLoader =
Thread.currentThread().getContextClassLoader();
		
		final Client createClient =
newInstance.createClient(wsdl,contextClassLoader);
		Object o =
contextClassLoader.loadClass("il.co.phoenix.underwrite.AgentWSRequest").newInstance();
		createClient.invoke("GetAgentDetails", agentWSRequest);

but aside form the fact that it doesn't find the classes, i would like to to
actually generate the classes in desing time but use the dynamic client with
them, but the package names are different.

also i don't know how to use the JaxWsClientFactoryBean there is no
documentation on it.

Benson Margulies-4 wrote:
> 
> The answer to your last question is yes. As for the rest, look at the
> sample for the dynamic client, a picture is worth 1000 words.
> 
> On Sun, Jan 11, 2009 at 2:39 PM, elhanan <ElhananM@fnx.co.il> wrote:
>>
>> but if i won't see any source, how will i use it? it's a chicken and egg
>> kinda thing ?
>>
>> my types are not very complex, usually one bean, containing simple types,
>> or
>> other array complex types.
>>
>> i tried using xmlbeans with axis2, but i created beans what tied to
>> xmlbeans
>> lib.
>>
>> wil wsd2java create java beans with just annotations? then i would be
>> able
>> to switch back to glue anytime, (that's the main thought here)
>>
>> Benson Margulies-4 wrote:
>>>
>>> CXF has a thing called the DynamicClient. At runtime, the
>>> DynamicClientFactory will eat the WSDL and create a proxy client. You
>>> never see any source. You can use 'invoke'-style methods to call it.
>>> It gets clumsier and clumsier depending on how complex your types are.
>>> You could give it a whirl and see what happens.
>>>
>>> Dan might know, as an alternative, if xmlbeans has an xsd-to-pojo
>>> generator that you could use to set up pojo-enough client objects.
>>>
>>> Or, you might find that you don't object to the plague of snails
>>> (@nnotations) that you get by using CXF's wsdl2java tool.
>>>
>>>
>>> On Sun, Jan 11, 2009 at 1:58 PM, elhanan <ElhananM@fnx.co.il> wrote:
>>>>
>>>> what do you mean complex object in flight?
>>>>
>>>> and for commiting, well if i were to write such code, i doubt my
>>>> company
>>>> would allow me to commit it as open source, but i always wanted to join
>>>> an
>>>> os project development as a hobby, i was looking into spring and seam,
>>>> but
>>>> i didnt' get the time to actually learn them good enough to develop to.
>>>>
>>>>
>>>> Benson Margulies-4 wrote:
>>>>>
>>>>> This depends on the complexity of your API.
>>>>>
>>>>> If you've got complex objects in flight, then you'd have to run
>>>>> wsdl2java, and that will add JAXB and JAX-WS annotations. 'Not quite
>>>>> pojos'.
>>>>>
>>>>> It would be nice if we could auto-generate classes that, when combined
>>>>> with the the Simple front end and Aegis, would conform to a given
>>>>> WSDL, but we've haven't got that code. If you'd like to write that
>>>>> code ... well, I'd be very happy to mentor/advise/commit for you.
>>>>>
>>>>>
>>>>>
>>>>> On Sun, Jan 11, 2009 at 11:22 AM, elhanan <ElhananM@fnx.co.il>
wrote:
>>>>>>
>>>>>> hi..
>>>>>>
>>>>>> we are considering on switching our current web service framework
>>>>>> which
>>>>>> is
>>>>>> glue to something else
>>>>>>
>>>>>> glue worked by gettting a wsdl, and then generating simple pojo's
>>>>>> which
>>>>>> had
>>>>>> no dependencies, and generating a mapping document based on wsdl's
>>>>>> schemas.
>>>>>> it had one interface which created a dynamic proxy at runtime, which
>>>>>> recived
>>>>>> an array of objects and return an object.
>>>>>>
>>>>>> we are interested in something which is as close as possible:
>>>>>>
>>>>>> given the following wsdl:
>>>>>> <?xml version="1.0" encoding="utf-16"?>
>>>>>> <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>>>>>> xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
>>>>>> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
>>>>>> xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
>>>>>> xmlns:tns="http://Phoenix.co.il/UnderWrite"
>>>>>> xmlns:s1="http://Phoenix.ESB.Hitum.Schemas.GreenSystemServices.Agent.AgentWSResponse"
>>>>>> xmlns:s="http://www.w3.org/2001/XMLSchema"
>>>>>> xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
>>>>>> xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
>>>>>> targetNamespace="http://Phoenix.co.il/UnderWrite"
>>>>>> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
>>>>>>  <wsdl:documentation
>>>>>> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">BizTalk
>>>>>> assembly "Phoenix.ESB.UnderWrite.Biztalk, Version=1.0.0.0,
>>>>>> Culture=neutral,
>>>>>> PublicKeyToken=3b97ca913d728b36" published web
>>>>>> service.</wsdl:documentation>
>>>>>>  <wsdl:types>
>>>>>>    <s:schema elementFormDefault="qualified"
>>>>>> targetNamespace="http://Phoenix.co.il/UnderWrite">
>>>>>>      <s:import
>>>>>> namespace="http://Phoenix.ESB.Hitum.Schemas.GreenSystemServices.Agent.AgentWSResponse"
>>>>>> />
>>>>>>      <s:element name="GetAgentDetails">
>>>>>>        <s:complexType>
>>>>>>          <s:sequence>
>>>>>>            <s:element minOccurs="0" maxOccurs="1" name="part"
>>>>>> type="tns:AgentWSRequest" />
>>>>>>          </s:sequence>
>>>>>>        </s:complexType>
>>>>>>      </s:element>
>>>>>>      <s:complexType name="AgentWSRequest">
>>>>>>        <s:sequence>
>>>>>>          <s:element minOccurs="1" maxOccurs="1" form="unqualified"
>>>>>> name="AgentNumber" type="s:int" />
>>>>>>        </s:sequence>
>>>>>>      </s:complexType>
>>>>>>      <s:element name="GetAgentDetailsResponse">
>>>>>>        <s:complexType>
>>>>>>          <s:sequence>
>>>>>>            <s:element minOccurs="0" maxOccurs="1"
>>>>>> ref="s1:AgentWSResponse"
>>>>>> />
>>>>>>          </s:sequence>
>>>>>>        </s:complexType>
>>>>>>      </s:element>
>>>>>>    </s:schema>
>>>>>>    <s:schema elementFormDefault="qualified"
>>>>>> targetNamespace="http://Phoenix.ESB.Hitum.Schemas.GreenSystemServices.Agent.AgentWSResponse">
>>>>>>      <s:element name="AgentWSResponse" type="s1:AgentWSResponse"
/>
>>>>>>      <s:complexType name="AgentWSResponse">
>>>>>>        <s:sequence>
>>>>>>          <s:element minOccurs="1" maxOccurs="1" form="unqualified"
>>>>>> name="ResponseCode" type="s:short" />
>>>>>>          <s:element minOccurs="0" maxOccurs="1" form="unqualified"
>>>>>> name="ResponseDescription" type="s:string" />
>>>>>>          <s:element minOccurs="0" maxOccurs="1" form="unqualified"
>>>>>> name="AgentName" type="s:string" />
>>>>>>          <s:element minOccurs="1" maxOccurs="1" form="unqualified"
>>>>>> name="CancelledDate" type="s:date" />
>>>>>>          <s:element minOccurs="0" maxOccurs="1" form="unqualified"
>>>>>> name="Street" type="s:string" />
>>>>>>          <s:element minOccurs="0" maxOccurs="1" form="unqualified"
>>>>>> name="HouseNumber" type="s:string" />
>>>>>>          <s:element minOccurs="0" maxOccurs="1" form="unqualified"
>>>>>> name="City" type="s:string" />
>>>>>>          <s:element minOccurs="1" maxOccurs="1" form="unqualified"
>>>>>> name="ZipCode" type="s:int" />
>>>>>>          <s:element minOccurs="1" maxOccurs="1" form="unqualified"
>>>>>> name="AreaCode" type="s:short" />
>>>>>>          <s:element minOccurs="1" maxOccurs="1" form="unqualified"
>>>>>> name="PhoneNumber" type="s:int" />
>>>>>>          <s:element minOccurs="1" maxOccurs="1" form="unqualified"
>>>>>> name="AreaCode2" type="s:short" />
>>>>>>          <s:element minOccurs="1" maxOccurs="1" form="unqualified"
>>>>>> name="PhoneNumber2" type="s:int" />
>>>>>>          <s:element minOccurs="1" maxOccurs="1" form="unqualified"
>>>>>> name="InspectorNumber" type="s:short" />
>>>>>>          <s:element minOccurs="1" maxOccurs="1" form="unqualified"
>>>>>> name="SuperInspectorNumber" type="s:short" />
>>>>>>          <s:element minOccurs="1" maxOccurs="1" form="unqualified"
>>>>>> name="StaffNumber" type="s:short" />
>>>>>>          <s:element minOccurs="1" maxOccurs="1" form="unqualified"
>>>>>> name="AgenceNumber" type="s:int" />
>>>>>>          <s:element minOccurs="0" maxOccurs="1" form="unqualified"
>>>>>> name="StaffName" type="s:string" />
>>>>>>          <s:element minOccurs="0" maxOccurs="1" form="unqualified"
>>>>>> name="EmployeeNumber" type="s:string" />
>>>>>>          <s:element minOccurs="0" maxOccurs="1" form="unqualified"
>>>>>> name="ProductionConfirmCode" type="s:string" />
>>>>>>          <s:element minOccurs="1" maxOccurs="1" form="unqualified"
>>>>>> name="AddProductionLifePolicy" type="s:short" />
>>>>>>          <s:element minOccurs="1" maxOccurs="1" form="unqualified"
>>>>>> name="AddProductionHealthPolicy" type="s:short" />
>>>>>>          <s:element minOccurs="0" maxOccurs="1" form="unqualified"
>>>>>> name="AddLoginEmployee1" type="s:string" />
>>>>>>          <s:element minOccurs="0" maxOccurs="1" form="unqualified"
>>>>>> name="AddLoginEmployee2" type="s:string" />
>>>>>>          <s:element minOccurs="0" maxOccurs="1" form="unqualified"
>>>>>> name="Result" type="s1:AgentWSResponseResult" />
>>>>>>        </s:sequence>
>>>>>>      </s:complexType>
>>>>>>      <s:complexType name="AgentWSResponseResult">
>>>>>>        <s:sequence>
>>>>>>          <s:element minOccurs="1" maxOccurs="1" form="unqualified"
>>>>>> name="Code" type="s:int" />
>>>>>>          <s:element minOccurs="0" maxOccurs="1" form="unqualified"
>>>>>> name="Description" type="s:string" />
>>>>>>        </s:sequence>
>>>>>>      </s:complexType>
>>>>>>    </s:schema>
>>>>>>  </wsdl:types>
>>>>>>  <wsdl:message name="GetAgentDetailsSoapIn">
>>>>>>    <wsdl:part name="parameters" element="tns:GetAgentDetails"
/>
>>>>>>  </wsdl:message>
>>>>>>  <wsdl:message name="GetAgentDetailsSoapOut">
>>>>>>    <wsdl:part name="parameters" element="tns:GetAgentDetailsResponse"
>>>>>> />
>>>>>>  </wsdl:message>
>>>>>>
>>>>>>
>>>>>> we have attempted using axis2 with jibx, however the problems is
in
>>>>>> the
>>>>>> top
>>>>>> level elements GetAgentDetails and GetAgentDetailsResponse. glue
did
>>>>>> not
>>>>>> generate these on their sub elements, (we would like to use same
sub
>>>>>> elements if possible) i'm guessing it created these elements on the
>>>>>> fly.
>>>>>>
>>>>>> is CXF capable of doing this?
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/cxf%27s-dynamic-proxies---tp21400946p21400946.html
>>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/cxf%27s-dynamic-proxies---tp21400946p21402626.html
>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/cxf%27s-dynamic-proxies---tp21400946p21403216.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/cxf%27s-dynamic-proxies---tp21400946p21414751.html
Sent from the cxf-user mailing list archive at Nabble.com.


Mime
View raw message