Port port = wsdlService.getPort( portName.getLocalPart() );
if ( port == null )
throw new JAXRPCException( Messages.getMessage("noPort00", "" +
portName) );
Binding binding = port.getBinding();
PortType portType = binding.getPortType();
if ( portType == null )
throw new JAXRPCException( Messages.getMessage("noPortType00", "" +
portName) );
List operations = portType.getOperations();
if ( operations == null )
throw new JAXRPCException( Messages.getMessage("noOperation01",
opName) );
Operation op = null ;
for ( int i = 0 ; i < operations.size() ; i++, op=null ) {
op = (Operation) operations.get( i );
if ( opName.equals( op.getName() ) ) break ;
}
if ( op == null )
throw new JAXRPCException( Messages.getMessage("noOperation01",
opName) );
// Get the URL
////////////////////////////////////////////////////////////////////
List list = port.getExtensibilityElements();
for ( int i = 0 ; list != null && i < list.size() ; i++ ) {
Object obj = list.get(i);
if ( obj instanceof SOAPAddress ) {
try {
SOAPAddress addr = (SOAPAddress) obj ;
URL url = new URL(addr.getLocationURI());
this.setTargetEndpointAddress(url);
}
catch(Exception exp) {
throw new JAXRPCException(
Messages.getMessage("cantSetURI00", "" + exp) );
}
}
}
// Get the SOAPAction
////////////////////////////////////////////////////////////////////
String opStyle = null;
BindingOperation bop = binding.getBindingOperation(opName,
null, null);
if ( bop == null )
throw new JAXRPCException( Messages.getMessage("noOperation02",
opName ));
list = bop.getExtensibilityElements();
for ( int i = 0 ; list != null && i < list.size() ; i++ ) {
Object obj = list.get(i);
if ( obj instanceof SOAPOperation ) {
SOAPOperation sop = (SOAPOperation) obj ;
opStyle = ((SOAPOperation) obj).getStyle();
String action = sop.getSoapActionURI();
if ( action != null ) {
setUseSOAPAction(true);
setSOAPActionURI(action);
}
else {
setUseSOAPAction(false);
setSOAPActionURI(null);
}
break ;
}
}
// Get the body's namespace URI and encoding style
////////////////////////////////////////////////////////////////////
BindingInput bIn = bop.getBindingInput();
if ( bIn != null ) {
list = bIn.getExtensibilityElements();
for ( int i = 0 ; list != null && i < list.size() ; i++ ) {
Object obj = list.get(i);
if( obj instanceof
javax.wsdl.extensions.mime.MIMEMultipartRelated){
javax.wsdl.extensions.mime.MIMEMultipartRelated mpr=
(javax.wsdl.extensions.mime.MIMEMultipartRelated) obj;
Object part= null;
List l= mpr.getMIMEParts();
for(int j=0; l!= null && j< l.size() && part== null; j++){
javax.wsdl.extensions.mime.MIMEPart mp
= (javax.wsdl.extensions.mime.MIMEPart)l.get(j);
List ll= mp.getExtensibilityElements();
for(int k=0; ll != null && k < ll.size() && part == null;
k++){
part= ll.get(k);
if ( !(part instanceof SOAPBody)) part = null;
}
}
if(null != part) obj= part;
}
if ( obj instanceof SOAPBody ) {
SOAPBody sBody = (SOAPBody) obj ;
list = sBody.getEncodingStyles();
if ( list != null && list.size() > 0 )
this.setEncodingStyle( (String) list.get(0) );
String ns = sBody.getNamespaceURI();
if (ns != null && !ns.equals(""))
setOperationName( new QName( ns, opName ) );
break ;
}
}
}
Service service = this.getService();
SymbolTable symbolTable = service.getWSDLParser().getSymbolTable();
BindingEntry bEntry = symbolTable.getBindingEntry(binding.getQName());
Parameters parameters = bEntry.getParameters(bop.getOperation());
// loop over paramters and set up in/out params
for (int j = 0; j < parameters.list.size(); ++j) {
Parameter p = (Parameter) parameters.list.get(j);