This is good and i will have a go in 2.x to see if a similar approach
works there. But i can't help thinking its a slightly convoluted
approach and as we have more flexibility in 2.x to add more APIs I
wonder if we should just add a more direct API method to set the URIs
with extra methods on Node, or also perhaps something like being able
to do: ((TuscanyServiceReference)serviceReference).setURI(uri)?

   ...ant

---------- Forwarded message ----------
From: Simon Nash <[email protected]>
Date: Wed, Dec 7, 2011 at 1:04 PM
Subject: Re: Dynamic service references (summary)
To: [email protected]


Millies, Sebastian wrote:
>
> Thank you very much for all your help, Simon.
>
You're very welcome.  I'm glad this is working for you now.


> I summarize here the result of this discussion for everyone's benefit:
>
> For dynamic web service endpoints, get a wsdl for the web service and define
> a service reference with interface.wsdl using wsdl.binding and a dummy
> URI in the binding.ws element.
>
One small point--it doesn't need to be interface.wsdl.  It should also work
if you use interface.java.

 Simon


> <sca:reference name="bapiCostcenterGetList" requires="sca:authentication">
>  <sca:interface.wsdl
>    interface="urn:functions#wsdl.interface(ZWS_BAPI_COSTCENTER_GETLIST)" />
>    <sca:binding.ws
>      
> wsdlElement="urn:functions#wsdl.binding(ZWS_BAPI_COSTCENTER_GETLISTBinding)"
>      uri="dynamicURI" />
> </sca:reference>
>
> At run time get the service reference, serialize it to XML, replace the
> dummy URI with the real endpoint URI, deserialize the reference and call the
> service method. The serialization coding goes like this:
>
>  public String serializeServiceReferenceXML( ServiceReference<T> sr )
>    throws IOException
>  {
>    ServiceReferenceImpl<T> sri = (ServiceReferenceImpl<T>) sr;
>    return sri.toXMLString();
>  }
>
>  public ServiceReference<T> deserializeServiceReferenceXML( String 
> serializedSR )
>    throws Exception
>  {
>    StringReader reader = new StringReader( serializedSR );
>    XMLStreamReader xmlReader = 
> XMLInputFactory.newInstance().createXMLStreamReader( reader );
>    ServiceReferenceImpl<T> sri = new ServiceReferenceImpl<T>( xmlReader );
>    return sri;
>  }
>
> The deserialized reference will work also when using policy sets (I have 
> tested
> that with basic authentication).
>
> For background on the changes that have been made to the 1.x  trunk to make
> this possible, refer to TUSCANY-3984.
>
> -- Sebastian
>
> IDS Scheer Consulting GmbH
> Geschäftsführer/Managing Directors: Kamyar Niroumand, Ivo Totev
> Sitz/Registered office: Altenkesseler Straße 17, 66115 Saarbrücken, Germany - 
> Registergericht/Commercial register: Saarbrücken HRB 19681
> http://www.softwareag.com
>

Reply via email to