Domanda

I want to take parameter type from dynamic client web service, but I can't. I wrote this code:

JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
Client client = dcf
        .createClient("http://localhost:8081/Isle/wsdl/IslemTopCarpBolCik.wsdl");

Object[] res;
try {
    res = client.invoke("toplama", 2, 3);
    System.out.println("Echo response: " + res[0]);

    Binding binding = client.getEndpoint().getBinding();
    BindingInfo bindingInfo = binding.getBindingInfo();

                 //binding.getInInterceptors();

    Collection<BindingOperationInfo> operations = bindingInfo
            .getOperations();


    for (BindingOperationInfo boi : operations) {
        OperationInfo oi = boi.getOperationInfo();
        BindingMessageInfo inputMessageInfo = boi.getInput();
        List<MessagePartInfo> parts = inputMessageInfo
                .getMessageParts();
        System.out.println("function name: "
                + oi.getName().getLocalPart());

    }
    System.out.println("binding: " + binding);

} catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

How can I get parameter type? (p.s. I don't want get parameter with parse.)

I want to know Do you know that is there a defined function to get the type of the parameters?

È stato utile?

Soluzione

this code worked for me..

        Binding binding = client.getEndpoint().getBinding();
        BindingInfo bindingInfo = binding.getBindingInfo();

        Collection<BindingOperationInfo> operations = bindingInfo
                .getOperations();

        for (BindingOperationInfo boi : operations) {
            BindingMessageInfo inputMessageInfo = boi.getInput();
            List<MessagePartInfo> parts = inputMessageInfo
                    .getMessageParts();

            System.out.println("method name: "
                    + parts.get(0).getConcreteName().getLocalPart());

            for (Field param : parts.get(0).getTypeClass()
                    .getDeclaredFields()) {
                System.out.println("param_name: " + param.getName()
                        + " type:" + param.getType());
            }

        }
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top