Issues with Apache HTTP Client and logging - java

In my Tapestry application, I need to do a GET request to a certain URL at some point. I do it like this (using Apache's HttpClient 4.2.1)
String scheme = getScheme();
String host = getHost();
int port = getPort();
String path = getPath();
String paramKey = getParamKey();
String paramValue = getParamValue();
URIBuilder builder = new URIBuilder();
builder
.setScheme(scheme)
.setHost(host)
.setPort(port)
.setPath(path)
.setParameter(paramKey, paramValue);
URI uri = builder.build();
HttpGet getRequest = new HttpGet(uri);
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpResponse response = httpClient.execute(getRequest);
When I deploy my WAR on Glassfish (3.1.2.2) and the code in question is executed, the following exception is thrown:
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;#78aded17 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category) (Caused by org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;#78aded17 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category))
at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
at org.apache.http.impl.client.AbstractHttpClient.<init>(AbstractHttpClient.java:187)
at org.apache.http.impl.client.DefaultHttpClient.<init>(DefaultHttpClient.java:146)
I specify this in my pom.xml
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.2.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
And I checked and made sure the Class that is "not being found" is actually in WEB-INF/lib/log4j-1.2.14.
Is there any way to solve this issue?

You have a classloader problem. Maybe another web application, that uses different log4j version, is loaded first. The classloader uses the first version of the class it finds.
Try this:
Remove all other applications from app server
Check that you don't have another log4j in classpath of the server.
Try to install and start your application.

Related

In AWS EC2 , java.lang.NoClassDefFoundError: org/apache/http/config/Lookup is thrown

I use Apache HTTP to outsource certain parts of my program to AWS Lamda.
When I run this locally on a Windows system, everything works.
But when the program is deployed (EC2 Instance - ubuntu environment) and a request is started via apache http. I get the following error message:
java.lang.NoClassDefFoundError: org/apache/http/config/Lookup
I use the following maven dependencies:
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.15</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>
At the following point in the code the error is thrown:
this.client = HttpClients.createDefault();
I have also tried other versions of Apache HTTP.
If you need more info let me know.
Can anyone tell me what I need to consider or what I may be doing wrong?

SOAP over Websocket with Appache CXF and Embedded Jetty

I have been trying to set a a SOAP endpoint with Websocket as transport protocol via CXF and implement invoke it via CXF. With Embeded jetty. I have tried a couple of approaches non of the aproaches worked unfortunatly. Here is what I did:
Aproach 1. According to CXF documentation websocket is supported as transport protocol and its support is given via
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-websocket</artifactId>
<version>3.3.2</version>
</dependency>
I have setup the following dependencies:
<dependency>
<groupId>org.asynchttpclient</groupId>
<artifactId>async-http-client</artifactId>
<version>2.0.39</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>3.3.2</version>
</dependency>
The code I executo is the following:
Endpoint endpoint = Endpoint.create(new MyHelloWorldServicePortType() {
#Override
public String sayHello(HelloMessage message) throws FaultMessage {
return message.sayHello();
}
};
((org.apache.cxf.jaxws.EndpointImpl)endpoint).getFeatures().add(new
WSAddressingFeature());
endpoint.publish("ws://localhost:8088/MyHelloWorldService" );
URL wsdlDocumentLocation = new URL("file:/path to wsdl file");
String servicePart = "MyHelloWorldService";
String namespaceURI = "mynamespaceuri";
QName serviceQN = new QName(namespaceURI, servicePart);
Service service = Service.create(wsdlDocumentLocation, serviceQN);
MyHelloWorldServicePortType port = service.getPort( MyHelloWorldServicePortType.class);
portType.sayHello(new HelloMessage("Say Hello"));
The result of this code is:
SEVERE: [ws] onError java.util.concurrent.TimeoutException: Request
timeout to not-connected after 60000 ms at
org.asynchttpclient.netty.timeout.TimeoutTimerTask.expire(TimeoutTimerTask.java:43)
at
org.asynchttpclient.netty.timeout.RequestTimeoutTimerTask.run(RequestTimeoutTimerTask.java:48)
at
io.netty.util.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:682)
at
io.netty.util.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:757)
at
io.netty.util.HashedWheelTimer$Worker.run(HashedWheelTimer.java:485)
at java.base/java.lang.Thread.run(Thread.java:834)
jun. 12, 2019 1:13:33 P.M.
org.apache.cxf.transport.websocket.ahc.AhcWebSocketConduit$AhcWebSocketWrappedOutputStream
connect SEVERE: unable to connect
java.util.concurrent.ExecutionException:
java.util.concurrent.TimeoutException: Request timeout to
not-connected after 60000 ms at
java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395)
at
java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1999)
at
org.asynchttpclient.netty.NettyResponseFuture.get(NettyResponseFuture.java:172)
at
org.apache.cxf.transport.websocket.ahc.AhcWebSocketConduit$AhcWebSocketWrappedOutputStream.connect(AhcWebSocketConduit.java:309)
at
org.apache.cxf.transport.websocket.ahc.AhcWebSocketConduit$AhcWebSocketWrappedOutputStream.setupWrappedStream(AhcWebSocketConduit.java:167)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1343)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1304)
at
org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:47)
at
org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1356)
at
org.apache.cxf.transport.websocket.ahc.AhcWebSocketConduit$AhcWebSocketWrappedOutputStream.close(AhcWebSocketConduit.java:139)
at
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
I have absolutly no idea why. When I try to connect via websocket chrome client on the URL. It says success. At the same time when connecting via the client it says Timeout.
Aproach 2.
I decided to cheat CXF and provide a handmade Websocket endpoint that will be used as a front to the CXF webservice. The idea is that the Client will send a message via websocket the message will be unwrapped and then sent over CXF. This aproach is very similar to the aproach here but here it uses JMS as transport
https://github.com/pbielicki/soap-websocket-cxf
In oprder to do this I created the following Websocket enpoint:
#ServerEndpoint("/jaxWSFront")
public class JaxWSFrontEnd {
#OnOpen
public void onOpen(final Session session) {
System.out.println("Hellooo");
}
#OnMessage
public void onMessage(String mySoapMessage,final Session session) throws Exception{
// The goal here is to get the soap message and redirect it via SOAP web //service. The JaxWSFacade acts as a point that understands websocket and then //gets the soap content and sends it to enpoint that understands SOAP.
session.getBasicRemote().sendText("Helllo . Now you see me.");
System.out.println("Hellooo again");
}
#OnClose
public void onClose(Session session, CloseReason closeReason) {
System.out.println("Hellooo");
}
#OnError
public void onError(Throwable t, Session session) {
System.out.println("Hellooo");
}
}
Now I pointed my Client proxy to the jaxWsFrontEnd instead of the webservice endpoint. My expectation is that I will recieve the SOAP message in the onMessage method and then I will be able to forwards to SOAP to the CXF web service.
Now my code looks like this:
server = new Server(8088);
ServletContextHandler context = new ServletContextHandler();
context.setContextPath( "/" );
server.setHandler(context);
ServerContainer container = WebSocketServerContainerInitializer.configureContext(context);
container.addEndpoint(JaxWSFrontEnd.class);
server.setHandler( context );
server.start();
Endpoint endpoint = Endpoint.create(new MyHelloWorldServicePortType() {
#Override
public String sayHello(HelloMessage message) throws FaultMessage {
return message.sayHello();
}
};
((org.apache.cxf.jaxws.EndpointImpl)endpoint).getFeatures().add(new
WSAddressingFeature());
URL wsdlDocumentLocation = new URL("file:/path to wsdl file");
String servicePart = "MyHelloWorldService";
String namespaceURI = "mynamespaceuri";
QName serviceQN = new QName(namespaceURI, servicePart);
Service service = Service.create(wsdlDocumentLocation, serviceQN);
MyHelloWorldServicePortType port = service.getPort( MyHelloWorldServicePortType.class);
portType.sayHello(new HelloMessage("Say Hello"));
For the second aproach I had in addition to the aproach 1 the following dependencies:
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-common</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>javax-websocket-server-impl</artifactId>
</dependency>
Result from aproach 2 is absolutly the same as Aproach 1 the exceptions I recieve are the same, with one minor difference. When I use the the Chrome websocket client and point it directly the the jaxWsFrontend I am able to successfuly send a message. Why I am not able to connect to websocket wia the CXF websocket transport mechanisms ???? What am I doing wrong ?
UPDATE: enabling the loging from NETTY. It apears that netty has thrown java.lang.NoSuchMethodError: io.netty.channel.DefaultChannelId.newInstance()Lio/netty/channel/DefaultChannelId;
Maybe I have a version compatability issue with netty. The version I can see is imported in the project is 4.1.33. It is a transitive dependency I don|t have it declared.
Ok I actualy managed to crack it alone. I will post the answer for completion. Apparantly CXF guys should update their documentation IMO. On their website it is stated that in order to enable Websocket as transport protocol we need
cxf-rt-transports-websocket dependency.
What they do not say is that you in addition need async-http-client not any version but 2.0.39 a prettey old one. The problem is that it automaticaly includes transitive dependencies to netty 4.1 and the error specified above begins to manifest. What you actualy need is nett 4.0.56
Here is the fragment that made the things work for me:
<dependency>
<groupId>org.asynchttpclient</groupId>
<artifactId>async-http-client</artifactId>
<version>2.0.39</version>
<exclusions>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-common</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-codec</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.0.56.Final</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-websocket</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>3.3.2</version>
</dependency>
Aproach 1 is working
Aproach 2 I managed to trigger the onConnect event, the onMessage timedout, but in my opinion it should work I am missing something small. Anyway I don|t have more time to spent and I am happy with Aproach 1.

sendgrid exception java.lang.NoSuchMethodError

I am getting exception when I try to use SendGrid sg = new SendGrid(sendGridAPIKEY);
It gives exception because send grid uses HttpClientBuilder.create().build(); internally.
I resolved this issue by adding following lines
DefaultHttpClient defaultHttpClient = new DefaultHttpClient();
Client sendGridClient = new Client(defaultHttpClient, false);
SendGrid sg = new SendGrid(sendGridAPIKEY, sendGridClient);
where DefaultHttpClient is deprecated.
But I want to know why HttpClientBuilder.create().build() line gives error.
I am using JDK 1.8 and following POM dependency
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.1</version>
</dependency>
<!-- send Grid dependency -->
<dependency>
<groupId>com.sendgrid</groupId>
<artifactId>sendgrid-java</artifactId>
<version>4.0.1</version>
</dependency>
Exception:
Nov 06, 2017 10:15:26 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [spring] in context with path [] threw exception [Handler processing failed; nested exception is java.lang.NoSuchMethodError: org.apache.http.impl.conn.CPool.setValidateAfterInactivity(I)V] with root cause
java.lang.NoSuchMethodError: org.apache.http.impl.conn.CPool.setValidateAfterInactivity(I)V
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConnectionManager.java:176)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConnectionManager.java:158)
at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:973)
at org.apache.http.impl.client.HttpClients.createDefault(HttpClients.java:58)
at com.sendgrid.Client.<init>(Client.java:76)
at com.sendgrid.Client.<init>(Client.java:56)
at com.sendgrid.SendGrid.<init>(SendGrid.java:24)

RestEasy Client Exception - Cannot serialize object to JSON

Edit: I saw the "duplicate" question but I do not have a dependency problem. I think it has something to do with not running in a container or using the MVN shade plugin to generate a "fat" jar.
I have this code calling a service - I know the service works b/c I can call via CURL. The issue is that the ResteasyClient is not recognizing the jackson-mapper serializer (I think):
ResteasyClient client = new ResteasyClientBuilder().build();
String endpoint = ClientUtil.getEndpoint();
ResteasyWebTarget target = client.target(endpoint);
IService simple = target.proxy(IService.class);
IAlertFact alertFact = ClientUtil.propertiesToAlertFact(alertProperties);
Response response = simple.processAlert(alertFact);
Here are the maven deps:
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.0.9.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<version>3.0.9.Final</version>
</dependency>
I thought having the resteasy-jackson-provider on the classpath would do the trick, but I keep getting this exception:
Caused by: javax.ws.rs.ProcessingException: could not find writer for content-type application/json type: com.myproject.AlertFact
at org.jboss.resteasy.core.interception.ClientWriterInterceptorContext.throwWriterNotFoundException(ClientWriterInterceptorContext.java:40)
Is there something I have to do to the ResteasyClientBuilder to make it use Jackson, or what?

Sending SOAP message to service with Java and WS Security: Internal Server Error

Our team is sending requests via soapUI to a remote service and collecting the responses. To automate this process, I made a simple java application being guided by the following tutorial.
http://drumcoder.co.uk/blog/2011/oct/18/httpclient-client-side-certificates/
The code is below.
Background:
Currently, we are using soapUI to send and receive messages. We specify a keystore for the requests and have to apply the outgoing WSS before sending. Once a response is received, we are manually copying and pasting it to a txt file. This gets very tedious and time consuming when there are hundreds of requests to process, so we are making a simple java application to run all of the requests and save off the corresponding responses. We used the above tutorial but it isn't working.
What is Working?
We currently save a SOAP request to a xml file manually, and then load, parse, and send the message to the service successfully using a java application. The response is also received and parsed successfully.
The Problem
The response received indicates a 500 internal server error, which is unexpected. Specifically, the custom error response indicates the service can not be found. I do recognize that a 500 internal server error is a pretty general problem and hard to debug without logs, though I do have some guesses.
Guesses to What is Wrong
One guess is that the endpoint / soap action is incorrect and the service cannot be found. I feel this is doubtful since we are using the exact credentials from the WSDL / soapUI.
Guess two is that SSL security is not being handled correctly and this is causing an internal server error during the server's authentication process. This is what I believe is the problem though I am unsure.
In General . . .
does anyone see the problem? Or if anything needs to be removed / added? Do you know of any other guides that may work better than this one for sending SOAP requests (I have tried java's javax.xml.soap API and that didn't work either, but resulted in the same error)? I have tried generating code from soapUI though I don't exactly know what to do with the resulting code (besides building with ant). I used http://java.dzone.com/tips/generating-client-java-code to generate the code though I don't know if it is what I am looking for.
Notes
We are calling a remote service that we do not have access to the logs.
The header in the SOAP request from the xml file is blank, unlike in soapUI where a security header is generated for the request when you apply an outgoing WSS. The bodies of the messages are equivalent. Even when the xml file containing the SOAP request loaded by the java application contains a non-expired security header (copied from soapUI after applying the outgoing WSS), the same invalid response is received.
When we copy the generated soapUI message from java (with non-expired security header) to soapUI, a valid response is received.
We do not have (and I suppose don't need) a truststore.
Can anyone see what may be going wrong? Is there any more information that would help solve the problem (minus logs)?
Thank You!
Code : (paths, passwords, and urls are general)
public class SOAPController {
static {
org.apache.xml.security.Init.init();
}
final static String KEY_STORE_PATH = "PATH";
final static String KEY_STORE_PASSWORD = "PASSWORD";
public static void main(String[] args) throws Exception {
KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
InputStream keystoreInput = new FileInputStream(KEY_STORE_PATH);
keystore.load(keystoreInput, KEY_STORE_PASSWORD.toCharArray());
System.out.println("Keystore has " + keystore.size() + " keys");
SchemeRegistry schemeRegistry = new SchemeRegistry();
SSLSocketFactory lSchemeSocketFactory = new SSLSocketFactory(keystore, KEY_STORE_PASSWORD);
schemeRegistry.register(new Scheme("https", 443, lSchemeSocketFactory));
final HttpParams httpParams = new BasicHttpParams();
DefaultHttpClient lHttpClient = new DefaultHttpClient(new SingleClientConnManager(schemeRegistry), httpParams);
String lUrl = "URL";
String lXml = getStringFromDocument(new File("request1.xml"));
System.out.println(lXml + "\n\n\n");
HttpPost lMethod = new HttpPost(lUrl);
HttpEntity lEntity = new StringEntity(lXml, "text/xml", "UTF-8");
lMethod.setEntity(lEntity);
lMethod.setHeader("SOAPAction", "soapaction");
HttpResponse lHttpResponse = lHttpClient.execute(lMethod);
System.out.println("Response status code: "
+ lHttpResponse.getStatusLine().getStatusCode());
System.out.println("Response body: ");
System.out.println(EntityUtils.toString(lHttpResponse.getEntity()));
}
public static String getStringFromDocument(File file)
{
try
{
DocumentBuilderFactory dbFactory = DocumentBuilderFactory
.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(file);
DOMSource domSource = new DOMSource(doc);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
transformer.transform(domSource, result);
return writer.toString();
}
catch(Exception ex)
{
ex.printStackTrace();
return null;
}
}
}
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.soap</groupId>
<artifactId>soap-util</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>soap-util</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient-cache</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.santuario</groupId>
<artifactId>xmlsec</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom2</artifactId>
<version>2.0.4</version>
</dependency>
<dependency>
<groupId>javax.xml.soap</groupId>
<artifactId>javax.xml.soap-api</artifactId>
<version>1.3.7</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
</plugin>
</plugins>
</build>
Example SOAP Request (note empty header element):
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header/>
<soap:Body>
... same as soapUI request ...
</soap:Body>
</soap:Envelope>
SOLVED:
So I left out a lot of header data. What made me realize this was when I looked at the raw request in soapUI, it had many headers that I did not have. I just added the following:
lMethod.addHeader(headerName1, headerValue1);
lMethod.addHeader(headerName2, headerValue2);
....

Categories

Resources