Hi,

If I understood correctly,the current juddi-client approach is 
- to read the uddi_service wsdl from the UDDI Server 
- parse it and extract the binding accesspoint from it.

I have to use a Microsoft UDDI, which does not provide the WSDL at all (as it 
is available @ OASIS)
So I just put the WSDLs temporarily on a local tomcat and was able to get the 
client running.

Sure the WSDLs could be deployed later on the IIS centrally but for performance 
aspects I'd like to avoid this server roundtrip. 
(also saves us from the need to deploy the WSDLs on each lifecyclestage server)

So I wondered whether there is any other way for instantiating the service and 
port without the WSDL at a Server.

Below is my current code for the InquiryService in the JAXWSTransport. 
Can you crosscheck with your project design and let me know, whether there any 
concerns with this approach ?


        public UDDIInquiryPortType getUDDIInquiryService(String endpointURL) 
throws TransportException {
                if (inquiryService==null) {
                        try {
                                // new QName for Service creation: with 
"UDDI_Service" instead of "UDDI_Inquiry_Port";
                                QName qNameService = new 
QName(UDDI_V3_SERVICE_NAMESPACE, INQUIRY_SERVICE_NAME);
                                
                                // 1. instantiate Inquiry Service
                                Method createMethod = 
Service.class.getDeclaredMethod("create", new Class[]{URL.class, QName.class});
                                URL url = 
this.getClass().getClassLoader().getResource("uddi_v3_service.wsdl");
                                Service service = 
(Service)createMethod.invoke(Service.class, new Object[]{url, qNameService});
                                
                                // 2. get Inquiry Service Port                  
        
                                QName qNamePort = new 
QName(UDDI_V3_SERVICE_NAMESPACE, INQUIRY_SERVICE);
                                // pass qName explicitly for Port constructor 
                                inquiryService = (UDDIInquiryPortType) 
service.getPort(qNamePort, UDDIInquiryPortType.class);

                                // 3. set concrete UDDI endpoint (taken from 
configuration, may vary per lifecycle stage)  
                                BindingProvider bp = (BindingProvider) 
inquiryService;
                                
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, 
endpointURL);

                                return (UDDIInquiryPortType)bp;
                        } catch (Exception e) {
                                throw new TransportException(e.getMessage(), e);
                        }
                } 
                return inquiryService;
        }


Pros so far:
- The WSDL is part of the juddi-ws-3.0.3.jar.
- No server roundtrip needed
- No need to put the WSDLs on any HTTP server

Note: code can be improved still (e.g. endpointURL NPE)

Thanks Frank.

Reply via email to