The WSDL is: http://wwwacc.ehealth.fgov.be/codage_1_0/codage?WSDL

Koen

2011/2/21 Koen Thomeer <[email protected]>

> Hello,
>
> I've to admit: I'm a beginning Java Developer. I'm comming from the PHP
> world.
>
> Can someone help me: I get this error:
>
>> java.lang.NoSuchMethodException:
>> be.smals.ehealth.codage.beans.OriginalDataType.setApplicationName(java.lang.String)
>>         at java.lang.Class.getMethod(Class.java:1605)
>>         at cxfehealth.Main.main(Main.java:47)
>>
>
> Thx,
>
> Koen
>
>
> package cxfehealth;
>
> import org.apache.log4j.BasicConfigurator;
> import org.apache.log4j.Logger;
> import org.apache.log4j.Level;
> import org.apache.ws.security.handler.WSHandlerConstants;
> import org.apache.cxf.endpoint.dynamic.DynamicClientFactory;
> import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
> import org.apache.cxf.endpoint.Client;
> import java.util.HashMap;
> import java.util.Map;
> import java.io.File;
> import java.net.URL;
> import java.lang.reflect.Method;
>
> /**
>  *
>  * @author Koen Thomeer, MD, http://koen.thomeer.be
>  */
> public class Main {
>
>     /**
>      * @param args the command line arguments
>      */
>     public static void main(String[] args) {
>         try {
>             // configure logging
>             BasicConfigurator.configure();
>             Logger.getLogger("org").setLevel(Level.WARN);
>
> java.util.logging.Logger.getLogger("").setLevel(java.util.logging.Level.WARNING);
>             // point to private wdsl
>             URL wsdlURL;
>             File wsdlFile = new File("src/codage.wsdl");
>             wsdlURL = wsdlFile.toURL();
>             System.out.println(wsdlURL);
>             // use CXF dynamic clients
>             DynamicClientFactory dcf = DynamicClientFactory.newInstance();
>             ClassLoader classloader =
> Thread.currentThread().getContextClassLoader();
>             Client client = dcf.createClient(wsdlURL, classloader);
>             Object EncodeRequestType =
> Thread.currentThread().getContextClassLoader().loadClass("be.smals.ehealth.codage.beans.OriginalDataType").newInstance();
>             //System.out.println(EncodeRequestType);
>             Method m =
> EncodeRequestType.getClass().getMethod("setApplicationName", String.class);
>             m.invoke(EncodeRequestType, "WWM");
>
>
>             // configure security settings
>             Map<String, Object> props = new HashMap<String, Object>();
>             props.put(WSHandlerConstants.ACTION, "Timestamp Signature");
>             props.put(WSHandlerConstants.TTL_TIMESTAMP, "15");
>             props.put(WSHandlerConstants.USER, "wwm_eh_key");
>             props.put(WSHandlerConstants.PW_CALLBACK_CLASS,
> ClientCallbackHandler.class.getName());
>             props.put(WSHandlerConstants.SIG_PROP_FILE,
> "client_sign.properties");
>             props.put(WSHandlerConstants.SIGNATURE_PARTS, "{Element}{
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp;Token;{Element}{http://schemas.xmlsoap.org/soap/envelope/}Body
> ");
>             props.put(WSHandlerConstants.SIG_KEY_ID, "DirectReference");
>             client.getEndpoint().getOutInterceptors().add(new
> WSS4JOutInterceptor(props));
>
>             // call the WebService
>             System.out.println(client.invoke("encode",
> EncodeRequestType)[0]);
>         } catch (Exception ex) {
>             ex.printStackTrace();
>         }
>     }
> }
>
>
> --
> *Koen Thomeer*, MD, MSc
> http://koen.thomeer.be
>



-- 
*Koen Thomeer*, MD, MSc
http://koen.thomeer.be

Reply via email to