Hello,
I am having trouble using the apache axis java bindings for the amazon wsdl soap service. I’ve generated the java classes from the wsdl document using apache axis version 1.4, but the examples in the help section of seller central do not appear to coincide with the generated code. So I'm trying to reimplement the example manually, and have run into trouble.
Here’s the code I'm using:
import com.warp9.amazon_integration.*;
import java.net.URL;
import java.io.*;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import org.apache.axis.attachments.OctetStream;
//import javax.activation.DataHandler;
//import javax.activation.FileDataSource;
public class MyAmazonClient {
public static void main(String[] args) {
Merchant merchant = new Merchant();
merchant.setMerchantIdentifier("M_BASEBAL_3183");
merchant.setMerchantName("M_BASEBAL_3183");
try{
MerchantInterface_PortType merchantInterface = new MerchantInterfaceMimeLocator().getMerchantInterface();
((MerchantInterface_BindingStub)merchantInterface).setUsername("[EMAIL PROTECTED]");
((MerchantInterface_BindingStub)merchantInterface).setPassword("PWDMASKED");
String messageType="_POST_PRODUCT_DATA_";
//BufferedInputStream in2 = new BufferedInputStream(new FileInputStream("mydocument.txt"));
//OctetStream oc = new OctetStream(IO.toByteArrray(in2));
FileInputStream fi = (new FileInputStream("mydocument.txt"));
byte[] b = new byte[fi.available()];
int i = fi.read(b);
OctetStream oc = new OctetStream(b);
DocumentSubmissionResponse response = merchantInterface.postDocument(merchant,messageType,oc);
// DataHandler dh = new DataHandler(new FileDataSource("mydocument.txt"));
//DocumentSubmissionResponse response = merchantInterface.postDocument(merchant,messageType,dh);
System.out.println("Batch Reference = "+response.getDocumentTransactionID());
//Display "Hello World!"
System.out.println("Hello World!");
}
catch (Exception ex){
ex.printStackTrace();
//System.out.println(e);
}
}
}
The error I'm getting is:
No port for method 'postDocument:(null)' with SOAPAction '"http://www.amazon.com/merchants/merchant-interface/MerchantInterface#postDocument#KEx3YXNwY1NlcnZlci9BbXpJU0EvTWVyY2hhbnQ7TGphdmEvbGFuZy9TdHJpbmc7TG9yZy9pZG9veC93YXNwL3R5cGVzL1JlcXVlc3RNZXNzYWdlQXR0YWNobWVudDspTHdhc3BjU2VydmVyL0FteklTQS9Eb2N1bWVudFN1Ym1pc3Npb25SZXNwb25zZTs="' found
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.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(AbstractSAXParser.java:1242)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.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.warp9.amazon_integration.MerchantInterface_BindingStub.postDocument(MerchantInterface_BindingStub.java:601)
at MyAmazonClient.main(MyAmazonClient.java:29)
Any advice you can give would be helpful.
Thanks,
=================================================
Liling Song Product
Specialist
Warp 9, Inc.
www.warp9inc.com
805.964.3313 (phone) x117
805.964.6968
(fax)
50 Castilian Drive, Suite A
Santa Barbara, CA
93117
=================================================