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