Hello: I am trying to process the ChannelAdvisor WSDL for their AdminService. They have posted their WSDL here: http://developer.channeladvisor.com/display/cadn/Admin+Service
I used WSDL2Java to create the client classes, but it does not generate a class for APICredentials. If I add the --all switch, it generates an APICredentials class but then there is no way to attach the credentials to the service call. Here is a page with the desired XML request: http://developer.channeladvisor.com/display/cadn/RequestAccess Here is a page with sample code in C# and other languages: http://developer.channeladvisor.com/display/cadn/Ping+Examples Unfortunately, none of their example include Java and their support staff has no knowledge of Java or Axis so I am left on my own to figure this out. I have found some postings on the Internet with people having similar problems as I am. They point to using a BasicHandler to manually insert the APICredentials into the SOAP header. I found some code for a handler: public class AuthenticationHandler extends BasicHandler { /** Invoke this hander */ public void invoke(MessageContext context) throws AxisFault { try { SOAPMessageContext smc = (SOAPMessageContext) context; SOAPMessage message = smc.getMessage(); QName APICredentialsName = new QName("http://api.channeladvisor.com/webservices/","APICredentials"); QName DeveloperKeyName = new QName("http://api.channeladvisor.com/webservices/","DeveloperKey"); QName PasswordName = new QName("http://api.channeladvisor.com/webservices/", "Password"); SOAPHeader header = message.getSOAPHeader(); SOAPHeaderElement cred = new SOAPHeaderElement(APICredentialsName); SOAPHeaderElement key = new SOAPHeaderElement(DeveloperKeyName); key.setObjectValue("DevKey"); SOAPHeaderElement pw = new SOAPHeaderElement(PasswordName); pw.setObjectValue("Pass"); cred.addChildElement(key); cred.addChildElement(pw); header.appendChild(cred); } catch (Exception e) { throw new AxisFault("Error during authentication", e); } } But, I am not sure how to use it to insert the credentials into the service call. If anyone has some insight, I would appreciate it. Thank you, Neil -- Neil Aggarwal, (972)834-1565, http://UnmeteredVPS.net/centos Virtual private server with CentOS 5.5 preinstalled Unmetered bandwidth = no overage charges --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
