Axis 2 - wsdl2code ****************** Links ===== - Sample_ - `Maven2 WSDL2Code Plug-in - Version 1.4`_ Dependencies ============ :: backport-util-concurrent backport-util-concurrent 3.0 commons-httpclient commons-httpclient 3.1 org.apache.axis2 axis2 1.4 org.apache.neethi neethi 2.0 org.apache.woden woden-api 1.0M8 org.apache.ws.commons.axiom axiom-api 1.2.7 org.apache.ws.commons.axiom axiom-impl 1.2.7 org.apache.ws.commons.schema XmlSchema 1.4 org.apache.xmlbeans xmlbeans 2.3.0 wsdl4j wsdl4j 1.6.1 junit junit 3.8.1 test Note: Several of those dependencies are used at runtime and are not required to generate the stub classes. Configuration ============= Update the ``wsdlFile`` and ``packageName`` as required: :: org.apache.axis2 axis2-wsdl2code-maven-plugin 1.4 wsdl2code com.sample.service http://winamini.promotiondemo.com/smsinbound/smsinbound.asmx?wsdl true true Note: I have commented out ``xmlbeans`` in the above sample... so I probably don't need all the dependencies. Usage ===== http://ws.apache.org/axis2/1_4/quickstartguide.html#clients Running the ``mvn package`` goal will create various classes in ``target/generated-sources``. Various stub classes will be generated which can be used like this: :: import com.sample.service.SMSInboundSMSInboundSoapStub; import com.sample.service.SMSInboundSMSInboundSoapStub.SMSRedemptionInfo; import com.sample.service.SMSInboundSMSInboundSoapStub.SendSMSData; import com.sample.service.SMSInboundSMSInboundSoapStub.SendSMSDataResponse; SMSInboundSMSInboundSoapStub stub = new SMSInboundSMSInboundSoapStub(); SendSMSData data = new SendSMSData(); data.setSMSNumber("07840 538 357"); data.setSMSMessage("zkHb5/2cFGRSVw2iKia6/XD0YJbxGl3awyqz4LNgSxE="); SendSMSDataResponse response = stub.SendSMSData(data); SMSRedemptionInfo result = response.getSendSMSDataResult(); System.out.println("The result code is [" + result.getResultCode() + "] SMS Message [" + result.getSmsMessage() + "]"); Issues ====== The element type "meta" must be terminated by the matching end-tag ------------------------------------------------------------------ :: [INFO] [axis2-wsdl2code:wsdl2code {execution: default}] Retrieving document at 'https://www.winaminieveryday.co.uk/SMSInbound/SMSInbound.asmx?wsdl'. [Fatal Error] SMSInbound.asmx?wsdl:9:467: The element type "meta" must be terminated by the matching end-tag "". org.xml.sax.SAXParseException: The element type "meta" must be terminated by the matching end-tag "". The web service had auto-discovery/documentation switched off. It was not possible to see the WSDL file: `How to hide WSDL?`_ from blog entry by `Kishore Gorjala`_ To solve the problem, we got an older copy of the WSDL, and updated the URL of the service. Another solution might be to get the WSDL file emailed. We changed the plugin configuration to point to a local copy of the WSDL as follows: :: C:/wip/855/winamini-promotiondemo-com.wsdl This is an interesting comment from a mailing list: *Sounds like you're passing an HTML stream into SAXBuilder, not an XML stream. It's seeing an HTML *META* tag and choking (since this tag doesn't have an end tag */META* in HTML). You'll have to figure out why the input stream doesn't contain what you're expecting it to contain*. So basically... I am being redirected to an html page which is not the normal WSDL XML file. .. _Sample: http://toybox/hg/sample/file/tip/java/sample-axis-web-service-client/ .. _`Maven2 WSDL2Code Plug-in - Version 1.4`: http://ws.apache.org/axis2/tools/1_4/maven-plugins/maven-wsdl2code-plugin.html .. _`How to hide WSDL?`: ../../misc/howto/csharp/how-to-hide-wsdl.html .. _`Kishore Gorjala`: http://csharpaspnet.blogspot.com/2007/12/how-to-hide-wsdl.html