operationName = new QName(opName);
}
public void setOperation(QName portName, String opName) {
if ( service == null )
throw new JAXRPCException( Messages.getMessage("noService04") );
// Make sure we're making a fresh start.
this.setPortName( portName );
this.setOperationName( opName );
this.setTargetEndpointAddress( (URL) null );
this.setEncodingStyle( null );
this.setReturnType( null );
this.removeAllParameters();
javax.wsdl.Service wsdlService = service.getWSDLService();
// Nothing to do is the WSDL is not already set.
if(wsdlService == null)
return;
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 ) {