You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by de...@apache.org on 2006/03/21 14:08:46 UTC
svn commit: r387519 -
/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
Author: deepal
Date: Tue Mar 21 05:08:45 2006
New Revision: 387519
URL: http://svn.apache.org/viewcvs?rev=387519&view=rev
Log:
-fixing 507
Modified:
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java?rev=387519&r1=387518&r2=387519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java Tue Mar 21 05:08:45 2006
@@ -896,101 +896,107 @@
QName wsdlServiceName,
String portName,
Options options) throws AxisFault {
- AxisService axisService;
try {
InputStream in = wsdlURL.openConnection().getInputStream();
Document doc = XMLUtils.newDocument(in);
WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
reader.setFeature("javax.wsdl.importDocuments", true);
Definition wsdlDefinition = reader.readWSDL(null, doc);
- axisService = new AxisService();
+ return createClientSideAxisService(wsdlDefinition,wsdlServiceName,portName,options);
+ } catch (IOException e) {
+ throw new AxisFault("IOException" + e.getMessage());
+ } catch (ParserConfigurationException e) {
+ throw new AxisFault("ParserConfigurationException" + e.getMessage());
+ } catch (SAXException e) {
+ throw new AxisFault("SAXException" + e.getMessage());
+ } catch (WSDLException e) {
+ throw new AxisFault("WSDLException" + e.getMessage());
+ }
+ }
- Service wsdlService;
- if (wsdlServiceName != null) {
- wsdlService = wsdlDefinition.getService(wsdlServiceName);
- if (wsdlService == null) {
- throw new AxisFault(
- Messages.getMessage("servicenotfoundinwsdl",
- wsdlServiceName.getLocalPart()));
- }
+ public static AxisService createClientSideAxisService(Definition wsdlDefinition,
+ QName wsdlServiceName,
+ String portName,
+ Options options) throws AxisFault {
+ AxisService axisService;
+ axisService = new AxisService();
- } else {
- Collection col = wsdlDefinition.getServices().values();
- if (col != null && col.size() > 0) {
- wsdlService = (Service) col.iterator().next();
- if (wsdlService == null) {
- throw new AxisFault(Messages.getMessage("noservicefoundinwsdl"));
- }
- } else {
+ Service wsdlService;
+ if (wsdlServiceName != null) {
+ wsdlService = wsdlDefinition.getService(wsdlServiceName);
+ if (wsdlService == null) {
+ throw new AxisFault(
+ Messages.getMessage("servicenotfoundinwsdl",
+ wsdlServiceName.getLocalPart()));
+ }
+
+ } else {
+ Collection col = wsdlDefinition.getServices().values();
+ if (col != null && col.size() > 0) {
+ wsdlService = (Service) col.iterator().next();
+ if (wsdlService == null) {
throw new AxisFault(Messages.getMessage("noservicefoundinwsdl"));
}
+ } else {
+ throw new AxisFault(Messages.getMessage("noservicefoundinwsdl"));
}
- axisService.setName(wsdlService.getQName().getLocalPart());
+ }
+ axisService.setName(wsdlService.getQName().getLocalPart());
- Port port;
- if (portName != null) {
- port = wsdlService.getPort(portName);
+ Port port;
+ if (portName != null) {
+ port = wsdlService.getPort(portName);
+ if (port == null) {
+ throw new AxisFault(Messages.getMessage("noporttypefoundfor", portName));
+ }
+ } else {
+ Collection ports = wsdlService.getPorts().values();
+ if (ports != null && ports.size() > 0) {
+ port = (Port) ports.iterator().next();
if (port == null) {
- throw new AxisFault(Messages.getMessage("noporttypefoundfor", portName));
- }
- } else {
- Collection ports = wsdlService.getPorts().values();
- if (ports != null && ports.size() > 0) {
- port = (Port) ports.iterator().next();
- if (port == null) {
- throw new AxisFault(Messages.getMessage("noporttypefound"));
- }
- } else {
throw new AxisFault(Messages.getMessage("noporttypefound"));
}
+ } else {
+ throw new AxisFault(Messages.getMessage("noporttypefound"));
}
- List exteElemts = port.getExtensibilityElements();
- if (exteElemts != null) {
- Iterator extItr = exteElemts.iterator();
- while (extItr.hasNext()) {
- Object extensibilityElement = extItr.next();
- if (extensibilityElement instanceof SOAPAddress) {
- SOAPAddress address = (SOAPAddress) extensibilityElement;
- options.setTo(new EndpointReference(address.getLocationURI()));
- }
+ }
+ List exteElemts = port.getExtensibilityElements();
+ if (exteElemts != null) {
+ Iterator extItr = exteElemts.iterator();
+ while (extItr.hasNext()) {
+ Object extensibilityElement = extItr.next();
+ if (extensibilityElement instanceof SOAPAddress) {
+ SOAPAddress address = (SOAPAddress) extensibilityElement;
+ options.setTo(new EndpointReference(address.getLocationURI()));
}
}
+ }
- Binding binding = port.getBinding();
- Iterator bindingOperations = binding.getBindingOperations().iterator();
- while (bindingOperations.hasNext()) {
- BindingOperation bindingOperation = (BindingOperation) bindingOperations.next();
- AxisOperation axisOperation;
- if (bindingOperation.getBindingInput() == null &&
- bindingOperation.getBindingOutput() != null) {
- axisOperation = new OutOnlyAxisOperation();
- } else {
- axisOperation = new OutInAxisOperation();
- }
- axisOperation.setName(new QName(bindingOperation.getName()));
- List list = bindingOperation.getExtensibilityElements();
- if (list != null) {
- Iterator exteElements = list.iterator();
- while (exteElements.hasNext()) {
- Object extensibilityElement = exteElements.next();
- if (extensibilityElement instanceof SOAPOperation) {
- SOAPOperation soapOp = (SOAPOperation) extensibilityElement;
- axisOperation.addParameter(new Parameter(AxisOperation.SOAP_ACTION,
- soapOp.getSoapActionURI()));
- }
+ Binding binding = port.getBinding();
+ Iterator bindingOperations = binding.getBindingOperations().iterator();
+ while (bindingOperations.hasNext()) {
+ BindingOperation bindingOperation = (BindingOperation) bindingOperations.next();
+ AxisOperation axisOperation;
+ if (bindingOperation.getBindingInput() == null &&
+ bindingOperation.getBindingOutput() != null) {
+ axisOperation = new OutOnlyAxisOperation();
+ } else {
+ axisOperation = new OutInAxisOperation();
+ }
+ axisOperation.setName(new QName(bindingOperation.getName()));
+ List list = bindingOperation.getExtensibilityElements();
+ if (list != null) {
+ Iterator exteElements = list.iterator();
+ while (exteElements.hasNext()) {
+ Object extensibilityElement = exteElements.next();
+ if (extensibilityElement instanceof SOAPOperation) {
+ SOAPOperation soapOp = (SOAPOperation) extensibilityElement;
+ axisOperation.addParameter(new Parameter(AxisOperation.SOAP_ACTION,
+ soapOp.getSoapActionURI()));
}
}
- axisService.addOperation(axisOperation);
}
-
- } catch (IOException e) {
- throw new AxisFault("IOException" + e.getMessage());
- } catch (ParserConfigurationException e) {
- throw new AxisFault("ParserConfigurationException" + e.getMessage());
- } catch (SAXException e) {
- throw new AxisFault("SAXException" + e.getMessage());
- } catch (WSDLException e) {
- throw new AxisFault("WSDLException" + e.getMessage());
+ axisService.addOperation(axisOperation);
}
return axisService;
}