發表文章

目前顯示的是 4月, 2011的文章

The different between JPA query statement and native SQL

For JPA, it supports named parameter, such as :parameter1, :parameter2. For native SQL query, it supports positional parameter, such as ?1, ?2.

Rebuild maven local repository index after updated the library

圖片
Please remember to rebuild the maven local repository index after your library is being updated. For example, common library that are developing.

Code for web service client to invoke OC4J web service with WSS Username Token policy

Put UsernameToken.xml in the same package of the web service client class. Please find the code below for the coding details: protected Location locationWebSPort = null; protected static volatile LocationWebSManager me; protected String endpoint = null; protected String userName = null; protected String password = null; protected LocationWebSManager(){ } public static LocationWebSManager getInstance(){ if (me == null){ synchronized(LocationWebSManager.class){ me = new LocationWebSManager(); } } return me; } public Location getWebService() throws Exception{ if (locationWebSPort == null){ synchronized(LocationWebSManager.class){ ClientPolicyFeature cpf = new ClientPolicyFeature(); InputStream asStream = LocationWebSManager.class.getResourceAsStream("UsernameToken.xml"); cpf.setEffectivePolicy(new InputStreamPolicySource(asStream)); URL url = new URL(getEndpoint()); QName qName = new QName("http://loc

Create Web Service with WSS Username Token Polic

Add @WebService(name="", serviceName="", portName="") annotation for the class. Add @Policy(uri = "policy:UsernameToken.xml") for the class. Add @WebMethod(operationName="") for method. Add @WebResult(name="") for method return name. Add @WebParam(name="") for method argument. Create policies folder under WEB-INF. Put the UsernameToken.xml under policies folder. The content of the xml file: <?xml version="1.0"?> <wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200512" > <sp:SupportingTokens> <wsp:Policy> <sp:UsernameToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200512/IncludeToken/AlwaysToRecipient"> <wsp:Policy> <sp:WssUsernameToken10/> </wsp:Policy> </sp:UsernameToken> </wsp:Policy> </sp:SupportingTokens>

Generate WebLogic Web Service Client on Eclipse

圖片
Add Dynamic Web Module and Oracle WebLogic Web Service Clients in Project Facets. Add Oracle WebLogic Server 11g in the Project Facets -> Runtimes. Right Click on the project and new a WebLogic Web Services -> Web Service Client. Select Remote WSDL Location. In the Customization Options, choose Define WSDL location at runtime when client instantiated.