XSLT-transformation in Java-Mapping with javax.xml
Hi,
we wanna use javax.xml for transformations in Java-Mapping.
Inside the Java-mapping we read in XSL-files to transform a XML-stream. With XSLT 1.0 everything works fine - but with XSLT 2.0 we are getting runtime errors.
Is it possible that javax.xml only supports XSLT 1.0?
Regards
Wolfgang
Hi ,
Jaxp 1.3 is available in this link -
http://java.sun.com/webservices/jaxp/
Use these jar files to process XSLT 2.0.
Nanda
Similar Messages
-
Java Mapping with an xml array as input
Hi Gurus,
I have to perform a java mapping to map some input xml contained in an array with a target message type. I have found a good java mapping example here:
Re: Please provide Java Mapping example
but my mapping input is not a single XML, but an XML array, thus I have a doubt...
How can I map multiple XML contained in an array with a target XML? I have to solve this problem into a Java mapping prospective.
Thanks to all!
Message was edited by:
Gabriele MorganteHey Stefan, I think he is refering to a n:1 multimapping.
If that is indeed the case, Gabriele, you will have to consider the initial tags inserted by mapping runtime to treat multimappings.
Suppose your XML message is like
<myMT xmlns="urn:mynamespace">
<value>xpto</value>
</myMT>
Then, if your source message interface occurrence is defined as unbounded in your interface mapping, your mapping program (message mapping, xslt, java mapping, whatever) will receive, from mapping runtime, a message like this:
<Messages xmlns="http://sap.com/xi/XI/SplitAndMerge">
<Message1>
<myMT xmlns="urn:mynamespace">
<value>xpto1</value>
</myMT>
<myMT xmlns="urn:mynamespace">
<value>xpto2</value>
</myMT>
<myMT xmlns="urn:mynamespace">
<value>xpto3</value>
</myMT>
</Message1>
</Messages>
Also, if you have more than 1 message type as source of your interface mapping, your mapping program will receive the other message types in <Message2>, <Message3>... tags.
The <Messages> and <MessageX> tags will always be automatically generated by mapping runtime when dealing with multimappings, which are mappings from m XML messages to n XML messages, with either m, n or both different of 1 (note that this definition includes mappings from 1 type to 1 type, when either source, target or both message types have max occurrence = ubounded).
Finally, remember that the output that your mapping program generates will also have to include these <Messages> and <MessageX> tags (with proper namespace), since mapping runtime will be expecting them. Message mappings treat those by default, but your xslt and java multimappings will have to explicitely include these tags in the output.
Regards,
Henrique. -
I am trying to use jaxb with Weblogic 6.1. I kept both the jaxb jar file in weblogic
classpath in setEnv script. I am getting the following error, when I am trying
to use jaxb
java.lang.NoClassDefFoundError: javax/xml/bind/MarshallableRootElement
I tried other options also like coping both jar file in jre/ext dir but then I
got security error.
I will appreciate if someone in this newsgroup comments or suugest some solution.
Thanks
JeewanOn 06 Aug 2002, Jeewan wrote:
>
I am trying to use jaxb with Weblogic 6.1. I kept both the jaxb jar
file in weblogic classpath in setEnv script. I am getting the
following error, when I am trying to use jaxb
java.lang.NoClassDefFoundError: javax/xml/bind/MarshallableRootElement
I tried other options also like coping both jar file in jre/ext dir
but then I got security error.
I will appreciate if someone in this newsgroup comments or suugest
some solution. Put the jaxb jar file in in your webapp's WEB-INF/lib directory and it
should work fine.
Barry -
Error in Java Mapping for Single XML conversion
We are working on ABAP Proxy --> SAP PI 7.1 --> SOAP (Synchronous Scenario).
(ECC -> PI -> Legacy CRM)
Client has provided a WSDL with Single Node of XML and asking us to pass the whole structure as an single string along with all the nodes of data structure. To perform mapping we are using Java Mapping.
Message which we are getting after Java Mapping:
Input
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_SOReject_Sender xmlns:ns0="http://MTSINDIA/TC/SalesOrderReject">
<ITEM>
<sSlsOrderCode>1001</sSlsOrderCode>
<sDlrCode>A250</sDlrCode>
<sRejectReason>Z2</sRejectReason>
<nCircleCode>2</nCircleCode>
</ITEM>
</ns0:MT_SOReject_Sender>
Output
<?xml version="1.0" encoding="UTF-8"?><MT_Trg xmlns:ns="urn:Test_File_to_File"><stringinp><?xml version="1.0" encoding="UTF-8"?><ns0:MT_SOReject_Sender xmlns:ns0="http://MTSINDIA/TC/SalesOrderReject"><ITEM><sSlsOrderCode>1001</sSlsOrderCode><sDlrCode>A250</sDlrCode><sRejectReason>Insufficient Stock Balance</sRejectReason><nCircleCode>2</nCircleCode></ITEM></ns0:MT_SOReject_Sender></stringinp></MT_Trg>
Is ther any way from which we can convert > as u201C>u201D and < as u201C<u201D. Required result is as follows
Required Output
<?xml version="1.0" encoding="UTF-8"?><MT_Trg xmlns:ns="urn:Test_File_to_File"><stringinp><?xml version="1.0" encoding="UTF-8"?><ns0:MT_SOReject_Sender xmlns:ns0="http://MTSINDIA/TC/SalesOrderReject"><ITEM><sSlsOrderCode>1001</sSlsOrderCode><sDlrCode>A250</sDlrCode><sRejectReason>Insufficient Stock Balance</sRejectReason><nCircleCode>2</nCircleCode></ITEM></ns0:MT_SOReject_Sender></stringinp></MT_Trg>
We are using following Java Code for the same.
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Element;
import org.w3c.dom.Document;
import org.w3c.dom.Text;
import com.sap.aii.mapping.api.*;
import com.sap.aii.mapping.api.StreamTransformation;
public class SingleStr implements StreamTransformation{
* @author user
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
public static void main(String args[]) throws Exception {
FileInputStream inFile =
new FileInputStream("C:/Documents and Settings/user.HR0102WILT00033/Desktop/Input.XML");
FileOutputStream outFile =
new FileOutputStream("C:/Documents and Settings/user.HR0102WILT00033/Desktop/Output.XML");
SingleStr xml = new SingleStr();
xml.execute(inFile, outFile);
System.out.println("Success");
public void setParameter(Map param) {
Map map = param;
public void execute(InputStream in, OutputStream out)
throws com.sap.aii.mapping.api.StreamTransformationException {
try {
//************************Code To Generate The XML Parsing Objects*****************************//
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transform = tf.newTransformer();
//Document doc = db.parse(in);
Document docout = db.newDocument();
Element root = docout.createElement("MT_Trg");
root.setAttribute("xmlns:ns","urn:Test_File_to_File");
docout.appendChild(root);
Element stringinp = docout.createElement("stringinp");
root.appendChild(stringinp);
BufferedReader inpxml = new BufferedReader(new InputStreamReader(in));
StringBuffer buffer = new StringBuffer();
String line="";
while ((line = inpxml.readLine()) != null)
buffer.append(line);
String inptxml=buffer.toString();
Text srcxml = docout.createTextNode(inptxml);
stringinp.appendChild(srcxml);
DOMSource domS = new DOMSource(docout);
transform.transform((domS), new StreamResult(out));
} catch (Exception e) {
System.out.print("Problem parsing the file: " + e.getMessage());
e.printStackTrace();
Please help!!We are using following Java Code for the same.
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Element;
import org.w3c.dom.Document;
import org.w3c.dom.Text;
import com.sap.aii.mapping.api.*;
import com.sap.aii.mapping.api.StreamTransformation;
public class SingleStr implements StreamTransformation{
public static void main(String args[]) throws Exception {
FileInputStream inFile =
new FileInputStream("C:/Documents and Settings/user.HR0102WILT00033/Desktop/Input.XML");
FileOutputStream outFile =
new FileOutputStream("C:/Documents and Settings/user.HR0102WILT00033/Desktop/Output.XML");
SingleStr xml = new SingleStr();
xml.execute(inFile, outFile);
System.out.println("Success");
public void setParameter(Map param) {
Map map = param;
public void execute(InputStream in, OutputStream out)
throws com.sap.aii.mapping.api.StreamTransformationException {
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transform = tf.newTransformer();
//Document doc = db.parse(in);
Document docout = db.newDocument();
Element root = docout.createElement("MT_Trg");
root.setAttribute("xmlns:ns","urn:Test_File_to_File");
docout.appendChild(root);
Element stringinp = docout.createElement("stringinp");
root.appendChild(stringinp);
BufferedReader inpxml = new BufferedReader(new InputStreamReader(in));
StringBuffer buffer = new StringBuffer();
String line="";
while ((line = inpxml.readLine()) != null)
buffer.append(line);
String inptxml=buffer.toString();
Text srcxml = docout.createTextNode(inptxml);
stringinp.appendChild(srcxml);
DOMSource domS = new DOMSource(docout);
transform.transform((domS), new StreamResult(out));
} catch (Exception e) {
System.out.print("Problem parsing the file: " + e.getMessage());
e.printStackTrace();
Please help!! -
All -
I'm new to consuming web services in JDeveloper. I'm using Oracle JDEV 10.1.3.3/OC4J. I'm using this version since it is compatible with Oracle EBS 12.1.3. My intent is to pull data from our third party recruitment app (Success Factors) and load that data into Oracle HRIS. I'm already doing this through a .NET application. I'm converting it to be a Java Concurrent Program in EBS. The code listed below is a stub call to verify I'm on the right track. I created a JDeveloper Web Services proxy project. I'm testing it locally on my windows desktop. When I'm able to consume the service successfully, then I'll think about moving it to the EBS server.
I'm getting the following error when I invoke the following service:
HTTP transport error: javax.xml.soap.SOAPException: java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Message send failed: String index out of range: -7
End point is: https://api4.successfactors.com/sfapi/v1/soap?wsdl
Any help/assistance would be much appreciated.
Below is my code and output of my test:
package emsc.oracle.apps.emscper.sfapi.proxy;
import HTTPClient.HTTPConnection;
import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.IsValidSession;
import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.IsValidSessionResponse;
import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.Login;
import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.LoginResponse;
import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.LoginResult;
import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.Logout;
import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.LogoutResponse;
import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.SFCredential;
import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.SFParameter;
import emsc.oracle.apps.emscper.sfapi.proxy.types.sfobject_sfapi_successfactors_com.Error;
import java.io.File;
import javax.xml.rpc.ServiceFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.Date;
import javax.xml.ws.BindingProvider;
import javax.xml.soap.SOAPException;
import java.util.Map;
import oracle.security.ssl.OracleSSLCredential;
public class SFAPITest {
// Declare members:
private String companyId;
private String userName;
private String password;
private String developerKey;
private Date effDt;
private String greaterThanEffDt;
private String lessThanEffDt;
// Declare constants:
final static private String breakLine = "+---------------------------------------------------------------------------+";
final static private String format = "yyyy-mm-dd";
private enum ReqId {
PrimaryReq(25),
PrimaryReqCEO(26),
EmCarePrimary(27),
RTI(28),
EmCareClinical(29);
private int reqId;
private ReqId() {
private ReqId(int value) {
reqId = value;
public int getReqId() {
return reqId;
// Getters and Setters:
protected String getCompanyId() {
return this.companyId;
protected void setCompanyId(String value) {
this.companyId = value;
protected String getUserName() {
return this.userName;
protected void setUserName(String value) {
this.userName = value;
protected String getPassword() {
return this.password;
protected void setPassword(String value) {
this.password = value;
protected String getDeveloperKey() {
return this.developerKey;
protected void setDeveloperKey(String value) {
this.developerKey = value;
protected Date getEffDt() {
return this.effDt;
protected void setEffDt(Date value) {
this.effDt = value;
protected String getGreaterThanEffDt() {
return this.greaterThanEffDt;
protected void setGreaterThanEffDt(String value) {
this.greaterThanEffDt = value;
protected String getLessThanEffDt() {
return this.lessThanEffDt;
protected void setLessThanEffDt(String value) {
this.lessThanEffDt = value;
public void runProgram()
SFAPIService mySFAPIService;
String CompletionText = "";
String effDtStr2 = null;
/* Code your program logic here.
* Use getJDBCConnection method to get the connection object for any
* JDBC operations.
* Use CpContext provided commit,rollback methods to commit/rollback
* data base transactions.
* Don't forget to release the connection before returning from this
* method.
/* Call setCompletion method to set the request completion status and
* completion text.
* Status values are ReqCompletion.NORMAL,ReqCompletion.WARNING,
* ReqCompletion.ERROR.
* Use Completion text message of length 240 characters. If it is more
* than 240 then full string will appear in log file and truncated 240
* characters will be used as request completion text.
try
ServiceFactory factory = ServiceFactory.newInstance();
mySFAPIService = (emsc.oracle.apps.emscper.sfapi.proxy.SFAPIService)factory.loadService(emsc.oracle.apps.emscper.sfapi.proxy.SFAPIService.class);
SFAPI api = mySFAPIService.getSFAPI();
/// SFAPI api = new SFAPI();
//Map<String, Object> requestContext = ((BindingProvider) api).getRequestContext();
//requestContext.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
System.out.println("ServiceName => " + mySFAPIService.getServiceName().toString());
System.out.println("End Point => " + mySFAPIService.getServiceName().toString());
System.out.println(breakLine);
// Authentication: Login to SFAPI:
SFCredential credential = new SFCredential();
// Fake credentials being passed in for this post:
credential.setCompanyId("XXX");
credential.setUsername("XXX");
credential.setPassword("XXX");
credential.setDeveloperKey("XXX");
HTTPConnection httpsConnection = null;
OracleSSLCredential _credential = new OracleSSLCredential();
_credential.setWallet("\\\\\\C:\\Program Files\\Java\\jdk1.6.0_33\\jre\\lib\\security", "ParkEstes3");
/*System.setProperty("javax.net.ssl.trustStore","C:\\\\\OraHome_1\\jdev\\jdevbin\\jdk\\jre\\lib\\security\\keystore");
System.setProperty("javax.net.ssl.trustStorePassword","changeit");
System.out.println(System.getProperty("javax.net.ssl.trustStore"));*/
// SFParameter: Define a generic SFParameter List. This is a necessary parameter
// to invoking calls in SFAPI:
/*System.setProperty("javax.net.ssl.keyStore",
"file:\\\C:\\jdk1.4.1\\jre\\lib\\security\\client.keystore");
System.setProperty("javax.net.ssl.keyStorePassword","welcome"); */
/* System.setProperty("oracle.net.wallet_location",
"(SOURCE=(METHOD=file)(METHOD_DATA=(DIRECTORY=\\\C:\Users\dparrish\Oracle\WALLETS)))"); // (2) */
File kstore = new File("C:\\OraHome_1\\jdev\\jdevbin\\jdk\\jre\\lib\\security\\jssecacerts");
boolean exists = kstore.exists();
if (!exists) {
System.out.println("Keystore does not exist");
else {
System.out.println("Keystore does exist");
System.setProperty("javax.net.ssl.trustStore", kstore.getAbsolutePath());
System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
//System.setProperty("proxySet", "false");
//System.setProperty("http.proxyHost", "127.0.0.1");
//System.setProperty("http.proxyPort", "8080");
System.out.println(kstore.getAbsolutePath());
List<SFParameter> lst = new ArrayList<SFParameter>();
SFParameter param = new SFParameter();
param.setName("");
param.setValue("");
lst.add(param);
SFParameter[] sfParam = lst.toArray(new SFParameter[lst.size()]);
Login login = new Login();
try {
login.setCredential(credential);
System.out.println("1");
login.setParam(sfParam);
System.out.println("2");
LoginResponse loginResponse = new LoginResponse();
LoginResult loginResult = new LoginResult();
try {
loginResponse = api.login(login);
catch (Exception e ) {
System.out.println(e.getMessage());
System.out.println("3");
try {
loginResult = loginResponse.getResult();
catch (Exception e ) {
System.out.println(e.getMessage());
System.out.println("4");
IsValidSession vs = new IsValidSession();
IsValidSessionResponse isValidSessionResponse = api.isValidSession(vs);
System.out.println("5");
if (isValidSessionResponse.isResult()) {
System.out.println("Session is valid");
System.out.println("Result => " + loginResult.getSessionId());
System.out.println(breakLine);
Logout logout = new Logout();
LogoutResponse logoutResponse = api.logout(logout);
if (logoutResponse.isResult()) {
System.out.println("Logout of SFAPI Successful");
else {
System.out.println("Logout of SFAPI Unsuccessful");
else {
System.out.println("Session is invalid");
List<Error> errors = new ArrayList<Error>();
for (int i = 0; i < loginResult.getError().length; i++) {
errors.add(loginResult.getError()[i]);
for (int i = 0; i < errors.size(); i++) {
System.out.println("Error Indice => " + i);
System.out.println("Error Code: => " + errors.get(i).getErrorCode());
System.out.println("Error Message: => " + errors.get(i).getErrorMessage());
System.out.println(breakLine);
} // end for loop of SFObject errors
} // end InvalidSession
catch (Exception e)
System.out.println("Session Credential Exception");
System.out.println("Exception => " + e.getMessage());
System.out.println(breakLine);
catch (Exception e)
System.out.println("Parameter List Exception");
System.out.println("Exception => " + e.getMessage());
System.out.println(breakLine);
} // end runProgram
// Constructor:
public SFAPITest() {
} // end constructor
public static void main (String args[]) {
try
SFAPITest test = new SFAPITest();
test.runProgram();
catch (Exception e) {
System.out.println("main exception => " + e.getMessage());
} // SFAPITest
Here is the output with trace:
WARNING: Unable to connect to URL: https://api4.successfactors.com:443/sfapi/v1/soap due to java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Message send failed: String index out of range: -7
Session Credential Exception
Exception => ; nested exception is:
HTTP transport error: javax.xml.soap.SOAPException: java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Message send failed: String index out of range: -7
+---------------------------------------------------------------------------+
Process exited with exit code 0.The other end is throwing back a programming error.
That might be because you are sending incorrect data and the other end fails to validate it.
You might be able to guess based on your C# code. But, since you are using soap one generic solution is available to you.
- Get an http proxy interceptor like wireshark.
- Run it while your C# app runs, collect the http requests from that.
- Run it while running your java code, collect the http requests from that.
Compare the two. -
I have created webservice client using jwsdp-2.0 + JDK 1.5
in Netbeans 4.1 IDE it
works perfectly in the netbeans and also works at the command prompt but when i
create a Jar file from the netbeans and run at the command prompt with following
i have included all the jar files from the jwsdp-2.0 pack in the manifest file and have
also specified the main class
java -jar test.jar it gives following error
java.lang.NoClassDefFoundError: javax/xml/rpc/soap/SOAPFaultExceptionYou need the JAX-RPC classes in your class path.
-
Hi,
Can you please let me know when java mapping with STAX will be supported in Netweaver XI?
Regards
SudhirHi Sudhir,
STAX is Stream API for XML. It works similar to SAX but is a pull based model. It can also work with multiple XSD's...
XI support of STAX will moslty be supported when XI supports Java EE 5. We can say that this will be supported very soon...
http://www.xml.com/pub/a/2003/09/17/stax.html presents the overview of STAX.
Hope this helps
Regards
Kiran.. -
I work with SOA 10.1.3.3 (Patched).
When I call an ESB Routing Service from BPEL, are generated an exception as follow:
<messages><input><WBPM_IKSelectDatiTx_in><part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="WBPM_DASelectDatiTxSelect_pn_prog_tx_inparameters"><WBPM_DASelectDatiTxSelect_pn_prog_txInputParameters xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/top/WBPMDASelectDatiTx">
<pn_prog_tx>3</pn_prog_tx>
</WBPM_DASelectDatiTxSelect_pn_prog_txInputParameters>
</part></WBPM_IKSelectDatiTx_in></input><fault><remoteFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>exception on JaxRpc invoke: HTTP transport error: javax.xml.soap.SOAPException: java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Bad response: 404 Not Found</summary>
</part></remoteFault></fault></messages>
I've already read the metalink note 427452.1 and I tried the 2 way indicated to solve this problem. But the problem persist.
In the ESB console the Web Services considered above:
WSDL URL http://wise-svr1.wise.com:7777/esb/slide/ESB_Projects/AppWBPMCicloPassivo_ESB_WBPMCicloPassivo/WBPM
URI endpoint SOAP http://wise-svr1.wise.com:7777/event/DefaultSystem/WBPM_DASelectDatiTx
When I click on WSDL URL explorer open an XML file
When I click on URI endpoint SOAP explorer result "Page not Found"
Thanks in advance
UmbertoHi,
Your problem is with the esb service since calling the endpoint in a browser should result in a test interface for the esb service. Do you have any errors in the logfiles after deploying or calling the endpoint? ($ORACLE_HOME\j2ee\oc4j_soa\log\oc4j_soa_default_group_1\oc4j\log.xml
Kind Regards,
Andre -
Slow performance with javax.xml.ws.Endpoint.publish method
I've published an endpoint on my computer with the javax.xml.ws.Endpoint.publish method. When I'm load testing my endpoint on the local machine, with the client side in another jvm, the endpoint reacts very fast (server side(endpoint) and the client side on the same computer). There's not performance problem there.
But when I try to run a load test with the server side endpoint on my local computer and the client side on another computer the endpoint reacts slow, very slow compared to the local scenario. Instead of 500 requests / second I get like 3 requests / second. Why?
When I look at the traffic between the client and the server running on different machines it's like 4,5 kB/sec on a 100Mbit connection. And almost no cpu activity (neither server or client).
When I've a web server, like Tomcat or Sun Java Application Server and deploy my endpoint there the traffics goes up to 400kB/sec. So then it works fine with good performance over the same network, same ip address, same port and everything.
Why is my endpoint so slow when I publish it with javax.xml.ws.Endpoint.publish instead of on a for example Tomcat. And why is the endpoint fast when I'm running client and server on the same machine?the timeout is a client side thing, most likely. you need to set the http request timeout on the client.
-
Hi,
I have created a class JaxmClient.java. When I compile the class with appropriate jar files assigned to -classpath it compiles successfully with no errors. But when I run the classe "java JaxmClient" it produces the following exception:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/soap/SOAPElement
Can someone help me I am knew to this technology.
Thanks in advanceI tried to use in my execution all the jar files that I used for compilation.
java -cp jaxm-jar; etc.jar Request
but it still gives me this execption
Exception in thread "main" java.lang.NoClassDefFoundError: Request
I am in the right directory where is the Request.class file is and it is present in this directory....
Thanks appreciate your help... -
Hi all,
i have a problem by solving an error in my code. The Code is mainly from Ian Darwin.
The code i am running works with j2sdk1.4.2_04. But now i have to bring it to work with jdk1.6.0_13.
The code parses xml documents. With small xml documents the code works. With large xml documents i get the following error while running the produced class file.
Exception in thread "main" java.lang.NullPointerException
at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.setChunkIndex(DeferredDocumentImpl.java:1944)
at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.appendChild(DeferredDocumentImpl.java:644)
at com.sun.org.apache.xerces.internal.parsers.AbstractDOMParser.characters(AbstractDOMParser.java:1191)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.characters(XMLDTDValidator.java:862)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:463)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:208)
at XParse.parse(XParse.java:38)
at XParse$JFileChooserrv.<init>(XParse.java:119)
at XParse.main(XParse.java:213)
I know what a java.lang.NullPointerException mens. But i don't know where i have to look for. Specially i don't know what or where "com.sun.org.apache...." is.
Is there a package that a have to add to the environment? Can some one tell my where i can find this package?
I wrote the code for some years ago, 2006 or so. With the knew jdk1.6.0_13 some thinks chance in the environment. Couldn't find what exactly.
The code has only 215 lines, but some how i can't add it to this Message, because Maximum allowed is only 7500.
Is there an other Forum, which may is better for my question?Here is the code:
import java.io.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import javax.swing.*;
import java.awt.Container;
import javax.swing.JTextArea;
* This code is mainly from @author Ian Darwin, [email protected]
public class XParse {
/** Convert the file */
public static void parse(File file, boolean validate) {
try {
System.err.println("");
String fileName = file.getAbsolutePath();
System.err.println("Parsing " + fileName + "...");
// Make the document a URL so relative DTD works.
//String uri = new File(fileName).getAbsolutePath();
//System.err.println(uri);
DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
if (validate)
f.setValidating(true);
DocumentBuilder p = f.newDocumentBuilder();
p.setErrorHandler(new MyErrorHandler(System.err));
//XmlDocument doc = XmlDocument.createXMLDocument(file);
boolean vaild = p.isValidating();
if (vaild) {
System.out.println("yes parsing");
Document doc = p.parse(file); // <<<< ERROR
System.out.println("Parsed OK");
} catch (SAXParseException ex) {
System.err.println("+================================+");
System.err.println("| *SAX Parse Error* |");
System.err.println("+================================+");
System.err.println(ex.toString());
System.err.println("At line " + ex.getLineNumber());
System.err.println("+================================+");
} /**catch (RuntimeException ex) {
System.err.println("+================================+");
System.err.println("| *SAX Parse Error* |");
System.err.println("+================================+");
System.err.println(ex.toString());
//System.err.println("At line " + ex.getLineNumber());
//System.err.println("At line " + ex.getMessage());
System.err.println("+================================+");
}**/ catch (SAXException ex) {
System.err.println("+================================+");
System.err.println("| *SAX Error* |");
System.err.println("+================================+");
System.err.println(ex.toString());
System.err.println("+================================+");
/*}} catch (SAXNotRecognizedException ex) {
System.err.println(" no SAX");*/
} catch (ParserConfigurationException ex) {
System.err.println(" ???");
} catch (IOException ex) {
System.err.println("+================================+");
System.err.println("| *XML Error* |");
System.err.println("+================================+");
System.err.println(ex.toString());
private static class JFileChooserrv {
JFileChooserrv(JFrame f, boolean vverabreiten) {
String openfile;
String verror;
boolean validate = true;
final JFrame frame = f;
String vFilename = "Z:\\Boorberg\\parsen_vista\\daten";
//String vFilename = "C:\\";
File vFile = new File(vFilename);
final JFileChooser chooser = new JFileChooser(vFile);
JFileFilter filter = new JFileFilter();
filter.addType("xml");
filter.addType("sgml");
filter.addType("html");
filter.addType("java");
filter.setDescription("strukturfiles");
chooser.addChoosableFileFilter(filter);
boolean vjeas = true;
chooser.setMultiSelectionEnabled(vjeas);
int returnVal = chooser.showOpenDialog(frame);
if (returnVal == JFileChooser.APPROVE_OPTION) {
//Array filearry[] = chooser.getSelectedFiles();
//if (vFile = chooser.getSelectedFiles()) {
//File file[] = chooser.getSelectedFiles();
File vfile[] = chooser.getSelectedFiles();
//String openfile = new String();
int vlenght = vfile.length;
if (vlenght>1) {
int x=0;
while (x< vlenght) {
parse(vfile[x], validate);
x = x +1;
if (vlenght<=1) {
File v2file = chooser.getSelectedFile();
parse(v2file, validate);
} else {
System.out.println("You did not choose a filesystem object.");
System.exit(0);
private static class JFileFilter extends javax.swing.filechooser.FileFilter {
protected String description, vnew;
protected ArrayList<String> exts = new ArrayList<String>();
protected boolean vtrue;
public void addType(String s) {
exts.add(s);
/** Return true if the given file is accepted by this filter. */
public boolean accept(File f) {
// Little trick: if you don't do this, only directory names
// ending in one of the extentions appear in the window.
if (f.isDirectory()) {
return true;
} else if (f.isFile()) {
Iterator it = exts.iterator();
while (it.hasNext()) {
if (f.getName().endsWith((String)it.next()))
return true;
// A file that didn't match, or a weirdo (e.g. UNIX device file?).
return false;
/** Set the printable description of this filter. */
public void setDescription(String s) {
description = s;
/** Return the printable description of this filter. */
public String getDescription() {
return description;
private static class MyErrorHandler implements ErrorHandler {
// Error handler output goes here
private PrintStream out;
MyErrorHandler(PrintStream out) {
this.out = out;
* Returns a string describing parse exception details
private String getParseExceptionInfo(SAXParseException spe) {
String systemId = spe.getSystemId();
if (systemId == null) {
systemId = "null";
String info = "URI=" + systemId +
" Line=" + spe.getLineNumber() +
": " + spe.getMessage();
return info;
// The following methods are standard SAX ErrorHandler methods.
// See SAX documentation for more info.
public void warning(SAXParseException spe) throws SAXException {
//System.exit(0);
//out.println("Warning: " + getParseExceptionInfo(spe));
public void error(SAXParseException spe) throws SAXException {
//System.exit(0);
String message = "Error: " + getParseExceptionInfo(spe);
throw new SAXException(message);
public void fatalError(SAXParseException spe) throws SAXException {
//System.exit(0);
String message = "Fatal Error: " + getParseExceptionInfo(spe);
throw new SAXException(message);
public static void main(String[] av) {
JFrame vframe = new JFrame("chose files to pars");
boolean vverabreiten = true;
boolean validate = true;
JFileChooserrv vdateienwaehlen = new JFileChooserrv(vframe, vverabreiten);
}The Stack Trace i posted in the last Message. But i couldn't read it, i am not a programmer. -
Hi
I deployed an ESB service.
I am trying to test it from Server Enterprise Manager, Webservices feature.
I wrapped up my original message with SOAP 1.1 and 1.2 specifications.
When I invoke the service, I am getting
java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Unable to get header stream in saveChanges error.
Any idea how to get rid of that ?
Thanks
PraveenThe current version of ESB does not support SOAP 1.2. You need to make sure your message contains the correct SOAP 1.1 namespace so ESB uses the correct SOAP version:
SOAP 1.1: http://schemas.xmlsoap.org/soap/envelope/
SOAP 1.2: http://www.w3.org/2003/05/soap-envelope
Kind Regards,
Andre Jochems -
I am trying to develop a web service client for amazon webservice.but i am getting this error while running the app. Can anyone please help me. I have installed the JWSDP and but could not understand why i have to locate all the jar files in the classpath?Please help.
===== error=========================================
C:\abr\classes>java -classpath c:\abr\test.jar;C:\abr\jaxrpc-api.jar;C:\abr\jaxrpc-impl.jar;C:\abr\jaxrpc-spi.jar;c:\abr\classes\amazon.jar;C:\abr\mail.jar;C:\a
br\saaj-api.jar;C:\abr\activation.jar;c:\abr\FastInfoset.jar;%classpath% Client
[b]Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/stream/XMLS
treamWriter
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at com.sun.xml.rpc.client.StreamingSender._writeRequest(StreamingSender.
java:672)
at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:87)
at amazon.AmazonSearchPort_Stub.authorSearchRequest(AmazonSearchPort_Stu
b.java:988)
at Client.main(Client.java:21)I'm assuming you're using JWSDP 1.6 as I see Fastinfoset.jar in your list. You are missing some jar files in your classpath there. The best way to know what you need is to look at the release notes for JWSDP 1.6. Since you're building a web serivce start with the table in there and lookup JAX-RPC. It'll show you what jar files are needed and what other libraries are needed. Now depending on what you're doing you don't really need all those.
For sure you're missing jsr173_api.jar which is where I believe that class you need is located. This is in the JWSDP_1_6\sjsxp\lib directory. You will probably need the other jar thats in there too. Best bet is to follow the dependancy chart in the release notes.
This should get you going.
Ryan -
Java.lang.NoClassDefFoundError: javax/xml/rpc/Service
Hi,
I have created client stubs for a webservice using axis wsdl2java tool. When I try calling these stubbed methods from JUnit tests, they are working fine but when I try to execute the jar (it is a swing) I get the following exception:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/rpc/Service
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at com.Gudds.SeCURE.MainUI.<init>(MainUI.java:76)
at com.Gudds.SeCURE.Main.Start(Main.java:62)
at org.owasp.webscarab.WebScarab.main(WebScarab.java:34)I have put the jaxrpc.jar in the classpath and I suppose this jar has the java.xml.rpc.service class but I donot understand why it fails while executing the jar but works fine from the eclipse IDe. Plase help me.
Regrdas,
Kundan1. Build jar file with MAINFEST.MF and Export of Eclipse , which has content:
suppose in folder:
c:\client.jar ( client of web service )
c:\contrib/lib/ axis apis
Main-Class: com.MainClassName
Class-Path: contrib\axis\jaxrpc.jar contrib\axis\activation.jar con
trib\axis\axis.jar contrib\axis\axis.jar contrib\axis\commons-disco
very.jar contrib\axis\wsdl4j.jar contrib\axis\saaj.jar contrib\axi
s\soap.jar contrib\axis\commons-logging.jar contrib\axis\log4j.jar
contrib\axis\mail.jar
2. build jar with ant: make sure the their are at least one blank between
values of Class-Path.
<jar destfile="../Client/client.jar" >
<fileset dir="${build.dir}"/>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="com.MainClass"/>
<attribute name="Class-Path" value=" contrib\axis\jaxrpc.jar contrib\axis\activation.jar .. "/>
</manifest>
</jar>
3. If you haven't pack you class file in jar, create a bat to set CLASSPATH
exactly to all jars.
Hope this helps -
ParserConfigurationException with javax.xml.parsers.DocumentBuilderFactory
Like many people, I am trying to just read in the contents of a XML file. My code compiles in WS studio and I publish it to the server. However, I keep getting a ParserConfigurationException when I try to get a DocumentBuilder from the factory. Below is my code:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse( new File(XMLFILE) );
Any idea why?The xmlfile is valid and here is the partial stacktrace
Root Error-1: javax/xml/parsers/ParserConfigurationException
java.lang.Exception: javax/xml/parsers/ParserConfigurationException
at Search5F_Results_jsp_5._jspService(_Search_5F_Results_jsp_5.java:206)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:127)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:390)
at org.apache.jasper.runtime.JspServlet.serviceJspFile
Do I need to set some system property?
Maybe you are looking for
-
OPEN_INTERFACE_REJECTS- INCONSISTENT SUPPL SITE
Payables Open Interface Import program is throwing INCONSISTENT SUPPL SITE, when a third party vendor site code and third party vendor site id is passed along with matching PO number for creating an invoice for third party vendor site. Can any one le
-
Problem when Activating Design-Configuration objects
Hi Everyone, We are facing a strange error in our XI system. When we are trying to activate any design/configuration object, we get an error, which states: <b>ERROR com.sap.aii.utilxi.swing.toolkit.ExceptionDialog: Throwable Thrown: MESSAGE ID: com.s
-
After upgrading to 3.6 all the web pages come out tiny. The text and the pictures. I must use the Ctrl + in order to make the web page fill my screen. What do I have to do to set a default size for every web site I visit?
-
Is there a way I can open the CD-ROM tray using Java?
Hi! I would like to make a pogram that makes the CD-ROM tray eject. Is there a method or something that does this? Virum
-
Customer Service, Warrenty and Technical Issues
I was so happy when I got my Lenovo Ideapad Y580. It ran like a dream and I loved the look and feel of it, but after 3 months I noticed that one of the speakers was cutting out and would only come back on whe I turned it to full volume. Then a few da