You are viewing a plain text version of this content. The canonical link for it is here.
Posted to agila-user@incubator.apache.org by Davide Ling <li...@libero.it> on 2005/10/30 16:00:01 UTC

Problem with invoke part 2

WSMessageBroker getService() method uses invoke portType attribute to 
find the right service,
so i suppose that portType attribute name (in process definition) is 
misleading (should be called servicePortName?)

<service name="AssessorWebService">
      <port name="assessorWebServiceSEIPort" ...
         ...               ^^^^^^^^^^^^^^^^^^^^^
     </port>
</service>

<invoke name="assessmentRequestInvoke"
            partnerLink="assessorPL"
            portType="ns:assessorWebServiceSEI"
            .... />          ^^^^^^^^^^^^^^^^^^^

private static QName getService(Definition def, String port) {
        Map services = def.getServices();
        for (Iterator serviceIter = services.keySet().iterator(); 
serviceIter.hasNext();) {
            QName serviceQName = (QName) serviceIter.next();
            Service service = (Service) services.get(serviceQName);
            if (service.getPort(port) != null) {
                return service.getQName();
            }
        }
        throw new InvocationException("No service have been defined for 
portType " + port);
    }

... so in my process definition I have to use service port name as 
portType in my Invoke
(wscompile generated WSDL with portType="assessorWebServiceSEI" and
 service port="assessorWebServiceSEIPort")

But getWSDLAdditionalInfo() is called using service port name as 
portType to search
the right binding, so if I don't give to portType and service port the 
same name I have an
InvocationException("Could not find a binding for port ...

<binding name="assessorWebServiceSEIBinding" 
type="tns:assessorWebServiceSEI">
      
.......                                                                             
^^^^^^^^^^^^^^^^^^^
</binding>

private static String[] getWSDLAdditionalInfo(Definition def, String 
portTypeName, String operationName) {
        Map bindings = def.getBindings();
        Binding portBinding = null;
        if (bindings != null) {
            for (Iterator bindingsIter = bindings.keySet().iterator(); 
bindingsIter.hasNext();) {
                QName bindingName = (QName) bindingsIter.next();
                Binding binding = (Binding) bindings.get(bindingName);
                if (binding == null) {
                    throw new InvocationException("Service " + 
def.getTargetNamespace() + " with port " +
                                                      portTypeName + " 
doesn't have any " + bindingName + " binding declared.");
                }
                if 
(binding.getPortType().getQName().getLocalPart().equals(portTypeName)) {
                    if (binding.getBindingOperation(operationName, null, 
null) == null) {
                        throw new InvocationException("Service " + 
def.getTargetNamespace() + " with port " +
                                                          portTypeName + 
" doesn't have the operation " + operationName +
                                                          " declared in 
the port binding.");
                    }
                    portBinding = binding;
                    break;
                }
            }
        }
        if (portBinding == null) {
            throw new InvocationException("Could not find a binding for 
port " + portTypeName +
                                              " in service " + 
def.getTargetNamespace());
        }
        [...]

I hope that you understand my problem.
Thanks

-- 
Davide Ling
Sito personale - http://davideling.altervista.org