# Can not able to run with JDK 1.5.0_11

I am getting the following error when i call run.bat under /firstletter

Please see, we can't change our JDK version to 1.6 as our applications are based on JDK 1.5.0_11.

Thanks
Prasanna

Building FirstLetter.java ...
FirstLetter.java:1: cannot access com.postalmethods.client.PostalMethodsClient
ar(com/postalmethods/client/PostalMethodsClient.class)
class file has wrong version 50.0, should be 49.0
Please remove or make sure it appears in the correct subdirectory of the classp
th.
import com.postalmethods.client.PostalMethodsClient;
^
1 error
FirstLetter.java has been built.
Running the FirstLetter program ...
4)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) FirstLetter program has run. ## Comments ### Please download this jar Please download this jar that was rebuilt using Java 1.5.0_20 and that should fix your issue. ### Update New Java samples and standalone .jar file are now compiled using JDK 1.5 and so compatible with versions 1.5 and above. ### Thanks for sending us the Thanks for sending us the link. I am facing the following error while running FirstLetter. I have given appropriate values for http.proxyHost,http.proxyPort,http.proxyUser and http.proxyPassword in run.bat file. Am i missing any other configuration?. Thanks Prasanna Exception in thread "main" com.postalmethods.client.api.PostalMethodsException: Error in SendLetter at com.postalmethods.client.PostalMethodsApiAdapter.sendLetter(Unknown Source) at com.postalmethods.client.PostalMethodsClient.sendLetter(Unknown Source) at FirstLetter.main(FirstLetter.java:28) Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? at org.apache.axis.AxisFault.makeFault(AxisFault.java:101) at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:154) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165) at org.apache.axis.client.Call.invokeEngine(Call.java:2784) at org.apache.axis.client.Call.invoke(Call.java:2767) at org.apache.axis.client.Call.invoke(Call.java:2443) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at com.postalmethods.wsdl.PostalWSSoap12Stub.sendLetter(Unknown Source) ... 3 more Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? at com.sun.net.ssl.internal.ssl.InputRecord.handleUnknownRecord(InputRecord.java:521) at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:355) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:723) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1030) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1057) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1041) at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:186) at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191) at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404) at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138) ... 13 more ### Hi Postal Methods Hi Postal Methods Support, Any updates on the above issue. Thanks Prasanna ### Hi Prasanna, I sent you an Hi Prasanna, I sent you an email message yesterday saying we are looking into this issue but it may take us a few days. The error message says there is a problem with the certificate or SSL connection. You may want to try and change the Web Service URL from "https" to "http" and see if this fixes the problem. We highly recommend using the SSL connection but you will be able to continue testing until this issue is resolved. ### Hi David, Thanks for the Hi David, Thanks for the response. I didn't see that mail. Where should i change the https setting to http. Thanks Prasanna ### Hi, Can you tell us where Hi, Can you tell us where should i change the https to http setting. You reply will help us to start our integration related testing. Thanks Prasanna ### Sorry for the delayed Sorry for the delayed response. I do not think this is a good idea anymore. I was able to replicate your problem and found that the problem was due to a the file "cacerts" missing from the java security folder (/usr/lib/jvm/java-1.5.0-gcj-4.4/jre/lib/security). The file exists in the JRE installation pack. Please try to copy it and try again. ### Hi David, I am still setting Hi David, I am still setting the same error. Whether i have to add any certificates to my cacerts.?. Thanks Prasanna ### Hi Prasanna, My name is Hi Prasanna, My name is Hernan and I work on Java issues with PostalMethods. From your messages above, it sounds like you're going through an HTTP proxy. That may be the issue if your proxy is not set up to handle SSL connections. The postalmethods.jar file uses SSL by default. It will attempt to communicate to the PostalMethods API using https://api.postalmethods.com. If I had to guess, your Java process is trying to start an SSL conversation with your proxy and is running into trouble. The easiest solution for you may be to not use SSL at all. I've build an alternate postalmethods.jar file that will use plain HTTP. You can download it here to test it out: http://drop.io/pmjavahttp If that works, and if you're okay using a non-SSL connection then that jar file should be perfectly okay to use. If you prefer to build it yourself you can by editing the ANT build file in the Java Samples bundle that the "firstLetter" example came from. That build.xml file has a "wsdl.url" property that you can change to use "http" instead of "https". Once you do that and call 'ant dist', you'll get a new postalmethods.jar file that won't use SSL. Let me know if you have any questions or further issues accessing the PostalMethods API. thanks! Hernan ### I tried both things - I tried both things - calling firstletter/run.bat using your jar.( I changed the classpath settings) and calling "ant dist" by changing the https to http in build.xml. Please look into these issues. Its more than a week and still we are not able to run your test programs. Our development setup is JDK 1.5.0_11 and we are behind proxy servers. Kindly let us know if we are missing something from our side. It will be really helpful if you allow us to submit "http" requests instead of using SOAP requests. Issue : 1. On using your jar, i got the following exception C:\vendors\postal\pmjava\firstLetter>run Building FirstLetter.java ... FirstLetter.java has been built. Running the FirstLetter program ... File to send: C:\vendors\postal\pmjava\misc\SampleLetter.pdf Making call to SendLetter... Exception in thread "main" com.postalmethods.client.api.PostalMethodsException: Error in SendLetter at com.postalmethods.client.PostalMethodsApiAdapter.sendLetter(Unknown S ource) at com.postalmethods.client.PostalMethodsClient.sendLetter(Unknown Sourc e) at FirstLetter.main(FirstLetter.java:28) Caused by: org.xml.sax.SAXParseException: White spaces are required between publ icId and systemId. at org.apache.axis.AxisFault.makeFault(AxisFault.java:101) at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:701) at org.apache.axis.Message.getSOAPEnvelope(Message.java:435) at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnders tandChecker.java:62) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206) at org.apache.axis.client.Call.invokeEngine(Call.java:2784) at org.apache.axis.client.Call.invoke(Call.java:2767) at org.apache.axis.client.Call.invoke(Call.java:2443) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at com.postalmethods.wsdl.PostalWSSoap12Stub.sendLetter(Unknown Source) ... 3 more Caused by: org.xml.sax.SAXParseException: White spaces are required between publ icId and systemId. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAX ParseException(ErrorHandlerWrapper.java:236) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalErro r(ErrorHandlerWrapper.java:215) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError( XMLErrorReporter.java:386) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError( XMLErrorReporter.java:316) at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(X MLScanner.java:1438) at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanExternalID(XML Scanner.java:1024) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.scanDo ctypeDecl(XMLDocumentScannerImpl.java:595) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$Prolog
Dispatcher.dispatch(XMLDocumentScannerImpl.java:860)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X
ML11Configuration.java:834)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X
ML11Configuration.java:764)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.
java:148)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Ab
stractSAXParser.java:1242)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
at org.apache.axis.encoding.DeserializationContext.parse(Deserialization
Context.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
... 12 more
FirstLetter program has run.

Issue : 2

I changed the https to http in build.xml and called "ant dist".

C:\vendors\postal\pmjava>ant dist
Buildfile: build.xml

init:

code.generation:
[axis-wsdl2java] WSDL2Java http://api.postalmethods.com/2009-02-26/PostalWS.asmx
?WSDL
[axis-wsdl2java] Parsing XML file: http://api.postalmethods.com/2009-02-26/Post
alWS.asmx?WSDL
[axis-wsdl2java] java.net.ConnectException: Connection timed out: connect

compile:
[javac] Compiling 12 source files to C:\vendors\postal\pm
java\build\dist
[javac] C:\vendors\postal\pmjava\src\com\postalmethods\cl
nt.model.ResultCode
st\com\postalmethods\client\model\ResultCode.class
[javac] class file has wrong version 50.0, should be 49.0
[javac] Please remove or make sure it appears in the correct subdirectory of
the classpath.
[javac] import com.postalmethods.client.model.ResultCode;
[javac] ^
[javac] 1 error

BUILD FAILED
C:\vendors\postal\pmjava>build.xml:58: Compile failed; see th
e compiler error output for details.

### We apologize for the long

We apologize for the long time this issue takes but we are still not sure the problem is on our side. Unfortunately we cannot accept letter sending requests using HTTP POST. It is not something we actively block. It is simply cannot not supported.

I was able to replicate your problem a few days ago using JDK 1.5 and Hernan's new JAR fixed it for me. There is a chance your proxy servers require a different approach.

Please try to use an internet browser from the same server you get this error and check if you can reach: https://api.postalmethods.com/2009-09-09/PostalWS.asmx

### It would be useful to see

It would be useful to see the HTTP Request/Response. Can you run Wireshark, tcpdump or another proxy to intercept the plain HTTP traffic between your machine and InterFAX? The "White spaces are required between publicId and systemId" error indicates a problem with parsing an XML message and we need to see the messages to fully understand the issue.

Your attempt to 'ant dist' failed to build because it could not connect to http://api.postalmethods.com/2009-02-26/PostalWS.asmx and that's also an indicator that something is not quite right with the network link between your machine and the InterFax API server:

[axis-wsdl2java] java.net.ConnectException: Connection timed out: connect

Seeing the network traffic will help. Also, as David suggested, it would be a good idea to try to hit the PostalMethods server via browser, curl, wget, or some other means to be sure you can see it.

Try this URL as well: http://api.postalmethods.com/2009-02-26/PostalWS.asmx

thanks!
Hernan

### Hi, I am able to reach the

Hi,

I am able to reach the URL "http://api.postalmethods.com/2009-02-26/PostalWS.asmx" from my browser. Please see, proxy settings are available in the browser.

If i run "ant dist", i found that in the "ethereal" that packets are being send to 194.169.197.187( ipaddress of api.postalmethods.com). I don't know whether our firewall allows TCP connections to your server. So i downloaded the file and save it in my computer and called "ant dist". I changed the protocol to file:///c:/ instead of http or https and got the following error.

compile:
[javac] Compiling 57 source files to C:\vendors\postal\pm
java\build\dist
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] Compiling 12 source files to C:\vendors\postal\pm
java\build\dist

com.postalmethods.client.model.ResultCode
[javac] class file has wrong version 50.0, should be 49.0
[javac] Please remove or make sure it appears in the correct subdirectory of
the classpath.
[javac] import com.postalmethods.client.model.ResultCode;
[javac] ^
[javac] 1 error

With out solving this error,i can't run test programs under firstletter as it uses https connection.

Thanks
Prasanna

### Thanks for the info,

Thanks for the info, Prassana. I think you should forget about the 'ant dist' step. Let's concentrate on running the 'firstLetter' program. If you're using the latest postalmethods.jar file I posted (http://drop.io/pmjavahttp) you won't get the class version error since this jar contains class files that will run with Java 1.5. Also, if you use that postalmethods.jar file you won't be making any https requests, just plain http requests.

I'd be interested to see the HTTP requests/responses that occur when you run that program. If you can capture those packets with ethereal I can take a look. Since you're able to fetch http://api.postalmethods.com/2009-02-26/PostalWS.asmx from your browser I think we can rule out a firewall issue. The proxy is still there though and the packets from ethereal will tell us exactly where the issue is. If you can save those to a file (packets.cap or anything you chose to name it) I'll take a look and will see if I can spot the issue.

thanks...
hernan

### Using etheral, i got

Using etheral, i got following the things.

Request is

Content-Type: application/soap+xml; charset=UTF-8

Accept: application/soap+xml, application/dime, multipart/related, text/*

User-Agent: Axis/1.4

Host: api.postalmethods.com

Cache-Control: no-cache

Pragma: no-cache

SOAPAction: "PostalMethods/SendLetter"

Content-Length: 69829

<?xml version="1.0" encoding="UTF-8"?>XXXXXXSending our first letter via PostalMethods!PDF..............Default

Response is

Date: Wed, 20 Jan 2010 06:27:46 GMT

Server: Apache/2.2.3 (CentOS)

Content-Length: 308

Connection: close

Content-Type: text/html; charset=iso-8859-1

Apache/2.2.3 (CentOS) Server at api.postalmethods.com Port 80

I hope that the above information will be helpful for debugging.

Thanks
Prasanna

### This looks wrong to

This looks wrong to me:

<?xml version="1.0" encoding="UTF-8"?>XXXXXXSending our first letter via PostalMethods!PDF..............Default

That's not valid XML. Is that really what's being sent over the wire? Have you made any changes to the FirstLetter.java test program? Please let me know what your code looks like. Also, if there's more to the request/response I'd love to see it.

The 404 response is also bizarre.

Can you tell me something about the machine you're running this code on? Is it Windows/Linux/OSX? Also, which version?

I may put together a test program to see if I can help diagnose the problem.

thnx...
Hernan

### Hi Hernan, HTTP Post content

Hi Hernan,

HTTP Post content is very long that's why i trimmed. I didn't do any changes. I will send information directly to your support mail-id. OS is windows XP professional.

Thanks
Prasanna

### This is very strange. The

This is very strange. The packet is sent and the response shows "Server: Apache/2.2.3 (CentOS)" while our Web Services are running on IIS.

1. Is there a way for you to bypass your proxies temporarily?
2. Please try to run this command in the Windows command prompt on the server and paste the results: tracert api.postalmethods.com

### I'm also a bit baffled by

I'm also a bit baffled by the 404 and the "Server: Apache/2.2.3 (CentOS)" header you're seeing in your HTTP response. Clearly that's not coming from PostalMethods and it would make sense that it's coming from your proxy. Can you verify that you're running a Linux/CentOS HTTP proxy? If so, can you check the logs for your proxy and see if it's reporting any errors forwarding traffic to PostalMethods?

Thanks also for your HTTP trace. If we can't figure out the issue with the network, I could still use a packet trace from ethereal (not just HTTP). That would tell me which host is actually returning the 404.

David's suggestion that you try going around your proxy temporarily is a good one also, it would tell us for sure that the issue is there.

Thanks for your patience and hang in there, we'll figure this out.
Hernan

### Hi Hernan & David Yes, page

Hi Hernan & David

Yes, page not found is coming from proxy-server. We identified the issue( DNS related issue ) and now i am able to run the program.

Thanks
Prasanna