Pages

Tuesday, September 30, 2014

Problems using JAX-WS 2.1 and JAXB 2.1 with JDK1.6 ?

Recently while working on web services I faced following problem where I was bound to use jdk1.6 to create web service because current version of weblogic11g and 12c works on jdk1.6.

       [ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /C:/Data/work/OSB/OSB_Workspace/SOASampleWS_HV3/src/generated/jaxws/at/spardat/soa/osb/soap/osbsoapexample/v1/OsbSoapExample.java:[46,9] C:\Data\work\OSB\OSB_Workspace\SOASampleWS_HV3\src\generated\jaxws\at\spardat\soa\osb\soap\osbsoapexample\v1\OsbSoapExample.java:46: cannot find symbol
symbol  : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[])
location: class javax.xml.ws.Service


I am using Maven and problem that I found that with wsimport code gets generated properly but while compiling generated code I get error as shown above. after investigation I found that code gets generated with JAV-WS2.1 as required but while compiling code with JDK1.6 java uses its own JAX-WS library provided in jdk which is older version and do not have this constructor defined in it. to overcome on this issue following is the way.

1. most simple approach is to copy jaxb-api.jar, jaxws-api.jar in your installed JDK1.6 /lib/endorsed directory.

2. if you do not want to do this and using wsimport/wsgen of JAX-WS2.1 then you can use endorse feature as WSIMPORT_OPTS=-Djava.endorsed.dirs=%JAXWS_HOME%/lib or WSGEN_OPTS=-Djava.endorsed.dirs=%JAXWS_HOME%/lib, option while calling your script, note that JAXWS_HOME points to your JAX-WS2.1 installation directory

3. if you are using maven to do the build of project then set following elements endoresedirs to your maven-compiler-plugin.

&ltplugin&gt
    &ltgroupId&gtorg.apache.maven.plugins&lt/groupId&gt
    &ltartifactId&gtmaven-compiler-plugin&lt/artifactId&gt
    &ltversion&gt3.1&lt/version&gt
        &ltconfiguration&gt
            &ltsource&gt1.6&lt/source&gt
            &lttarget&gt1.6&lt/target&gt
            &ltcompilerArguments&gt
             &ltendorseddirs&gt${project.build.directory}/endorsed&lt/endorseddirs&gt
           &lt/compilerArguments&gt
        &lt/configuration&gt
&lt/plugin&gt

Friday, July 25, 2014

JMeter 2.10 send SOAP requst gives unmarshalling error on server unable to support special unicode german carecter


To test web service I am using JMeter 2.10  with OSB (Oracle Service Bus), testing worked fine, but when we tried to send some special characters like 'ÖÜÄ' etc in XML data of  SOAP request I found that OSB was not able to parse it.  after several checks I also checked that when sending soap request XML has  UTF-8 encoding

xml request look like
&lts:envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt
 &lts:header&gt
  .... some header
 &lt/s:header&gt
 &lts:body&gt
  &ltnameapp&gtsome special charecters Üäöü here &lt/nameapp&gt
&lt/s:body&gt&lt/s:envelope&gt
when i took a look at raw http header information of request it looks like in Jmeter as follows
Request Headers:
Connection: keep-alive
Content-Type: text/xml; charset=utf-8
dynaTrace: PC=JMETER;NA=Soap Request (INA, Small Input - Small Output);VU=Client 10
Content-Length: 2220
Host: bac.edf.to.do:24001
User-Agent: Apache-HttpClient/4.2.6 (java 1.5)
after lot of R AND D I found that when in above raw request it uses http sampler implementation of HttpClient/4.2.6 so i change in JMeter http sampler implementation from HttpClient/4.2.6 to HttpClient/3.1 and request worked.


Well I need to investigate further may be a bug in current version of apache HttpClient or Jmeter , but this was the solution to my current problem. hope this helps to you as well.