I used axis 1.2 beta 2 to create java classes to support the wsdl.
I deploy the war and query axis for a wsdl listing
the listing ( ...?wsdl ) does not contain any reference to the mime multipart in the binding section.
Am I doing something wrong? Any help is appreciated. Could this be why my client keeps getting an error:
Exception: org.xml.sax.SAXException: Invalid element in com.lmtas.swa.services.ClaimDetailType - ClaimDetail
Raul
I have attached the orig wsdl, gen wsdl, and an ant build file.
Hector Flores wrote:
The request:
POST /swa/services/SWAServicePort HTTP/1.0
Content-Type: multipart/related; type="text/xml"; start="<33D7951A943F17FC2DC728F16EA9D6CD>"; boundary="----=_Part_0_5965416.1093722817593"
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.2beta
Host: localhost:8080
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: "capeconnect:SWAService:SWAServicePortType#SendClaim"
Content-Length: 3870
------=_Part_0_5965416.1093722817593 Content-Type: text/xml; charset=UTF-8 Content-Transfer-Encoding: binary Content-Id: <33D7951A943F17FC2DC728F16EA9D6CD>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><SendClaim xmlns=""><ns1:ClaimDetail xmlns:ns1="http://com.lmtas.swa.services"><Name>Hello</Name><ClaimForm>cid:[EMAIL PROTECTED]</ClaimForm></ns1:ClaimDetail><ClaimPhoto href="cid:E9D0154BF9B055D53B4997D300D6637B" xsi:type="ns2:Image" xmlns:ns2="http://xml.apache.org/xml-soap"/></SendClaim></soapenv:Body></soapenv:Envelope>
------=_Part_0_5965416.1093722817593 Content-Type: image/jpeg Content-Transfer-Encoding: binary Content-Id: <E9D0154BF9B055D53B4997D300D6637B>
����
And the reply: HTTP/1.1 500 Internal Server Error Set-Cookie: JSESSIONID=78B56D28E2FD0EF313574710AC0535F5; Path=/swa Content-Type: text/xml;charset=utf-8 Date: Sat, 28 Aug 2004 19:53:37 GMT Server: Apache-Coyote/1.1 Connection: close
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server.userException</faultcode><faultstring>org.xml.sax.SAXException: Invalid element in com.lmtas.swa.services.ClaimDetailType - ClaimDetail</faultstring><detail><ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">raul</ns1:hostname></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
<?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="http://com.lmtas.swa.services" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://com.lmtas.swa.services" xmlns:intf="http://com.lmtas.swa.services" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <!--WSDL created by Apache Axis version: 1.2beta Built on Jul 12, 2004 (07:08:50 EDT)--> <wsdl:types> <schema elementFormDefault="qualified" targetNamespace="http://com.lmtas.swa.services" xmlns="http://www.w3.org/2001/XMLSchema"> <import namespace="http://xml.apache.org/xml-soap"/> <complexType name="ClaimDetailType"> <sequence> <element name="Name" nillable="true" type="xsd:string"/> <element name="ClaimForm" nillable="true" type="xsd:anyURI"/>
</sequence>
</complexType>
<element name="ClaimDetail" type="impl:ClaimDetailType"/>
<element name="ClaimPhoto" type="apachesoap:Image"/>
<element name="ClaimRefNo" type="xsd:string"/>
</schema>
</wsdl:types>
<wsdl:message name="SendClaimRequest">
<wsdl:part element="impl:ClaimDetail" name="ClaimDetail"/>
<wsdl:part element="impl:ClaimPhoto" name="ClaimPhoto"/>
</wsdl:message>
<wsdl:message name="SendClaimResponse">
<wsdl:part element="impl:ClaimRefNo" name="ClaimRefNo"/>
</wsdl:message>
<wsdl:portType name="SWAServicePortType">
<wsdl:operation name="SendClaim" parameterOrder="ClaimDetail ClaimPhoto">
<wsdl:input message="impl:SendClaimRequest" name="SendClaimRequest"/>
<wsdl:output message="impl:SendClaimResponse" name="SendClaimResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SWAServicePortSoapBinding" type="impl:SWAServicePortType">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="SendClaim">
<wsdlsoap:operation soapAction="capeconnect:SWAService:SWAServicePortType#SendClaim"/>
<wsdl:input name="SendClaimRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="SendClaimResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SWAService">
<wsdl:port binding="impl:SWAServicePortSoapBinding" name="SWAServicePort">
<wsdlsoap:address location="http://localhost/swa/services/SWAServicePort"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
name="SWAService"
targetNamespace="http://com.lmtas.swa.services"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:ref="http://ws-i.org/profiles/basic/1.1/xsd"
xmlns:soapbind="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://com.lmtas.swa.services"
xmlns:types="http://com.lmtas.swa.services"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<xsd:schema
targetNamespace="http://com.lmtas.swa.services"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!-- <xsd:import namespace="http://ws-i.org/profiles/basic/1.1/xsd"/> -->
<xsd:import
namespace="http://ws-i.org/profiles/basic/1.1/xsd"
schemaLocation="wsi-bp1.1.xsd"/>
<xsd:element name="ClaimRefNo" type="xsd:string"/>
<xsd:complexType name="ClaimDetailType">
<xsd:sequence>
<xsd:element name="Name" type="xsd:string"/>
<xsd:element name="ClaimForm" type="ref:swaRef"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="ClaimDetail" type="types:ClaimDetailType"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="ClaimOut">
<wsdl:part element="tns:ClaimRefNo" name="out"/>
</wsdl:message>
<wsdl:message name="ClaimIn">
<wsdl:part element="tns:ClaimDetail" name="body"/>
<wsdl:part name="ClaimPhoto" type="xsd:base64Binary"/>
</wsdl:message>
<wsdl:portType name="SWAServicePortType">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">All the operations</wsdl:documentation>
<wsdl:operation name="SendClaim">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">This operation does have an attachment with it</wsdl:documentation>
<wsdl:input message="tns:ClaimIn"/>
<wsdl:output message="tns:ClaimOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SWAServiceBinding" type="tns:SWAServicePortType">
<soapbind:binding
style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="SendClaim">
<soapbind:operation
soapAction="capeconnect:SWAService:SWAServicePortType#SendClaim"/>
<wsdl:input>
<mime:multipartRelated>
<mime:part>
<soapbind:body parts="body" use="literal"/>
</mime:part>
<mime:part>
<mime:content part="ClaimPhoto" type="image/jpeg"/>
</mime:part>
</mime:multipartRelated>
</wsdl:input>
<wsdl:output>
<soapbind:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SWAService">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">SWA Service documentation HECTOR RAUL FLORES</wsdl:documentation>
<wsdl:port binding="tns:SWAServiceBinding" name="SWAServicePort">
<soapbind:address location="http://localhost/swa/SWAService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
<!--
This build script assumes that the source code of your web application
is organized into the following subdirectories underneath the source
code directory from which you execute the build script:
docs Static documentation files to be copied to
the "docs" subdirectory of your distribution.
src Java source code (and associated resource files)
to be compiled to the "WEB-INF/classes"
subdirectory of your web applicaiton.
web Static HTML, JSP, and other content (such as
image files), including the WEB-INF subdirectory
and its configuration file contents.
$Id: build.xml.txt,v 1.5 2003/12/22 09:22:02 remm Exp $
-->
<project name="My Project" default="compile" basedir=".">
<property file="build.properties"/>
<property file="${user.home}/build.properties"/>
<property name="app.name" value="swa"/>
<property name="app.path" value="/${app.name}"/>
<property name="app.version" value=""/>
<property name="build.home" value="${basedir}/build"/>
<property name="dist.home" value="${basedir}/dist"/>
<property name="docs.home" value="${basedir}/docs"/>
<property name="manager.url" value="http://localhost:8080/manager"/>
<property name="src.home" value="${basedir}/src"/>
<property name="web.home" value="${basedir}/web"/>
<!-- Configure the custom Ant tasks for the Manager application -->
<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"/>
<taskdef name="list" classname="org.apache.catalina.ant.ListTask"/>
<taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"/>
<taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"/>
<taskdef name="roles" classname="org.apache.catalina.ant.RolesTask"/>
<taskdef name="start" classname="org.apache.catalina.ant.StartTask"/>
<taskdef name="stop" classname="org.apache.catalina.ant.StopTask"/>
<taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask"/>
<!-- ==================== all ===================================== -->
<target name="all" depends="clean,compile"
description="Clean build and dist directories, then compile"/>
<!-- ==================== clean ===================================== -->
<target name="clean" description="Delete old build and dist directories">
<delete dir="${build.home}"/>
<delete dir="${dist.home}"/>
</target>
<!-- ==================== compile ===================================== -->
<target name="compile" depends="prepare" description="Compile Java sources">
<path id="compile.classpath">
<pathelement location="${build.home}/WEB-INF/classes"/>
<fileset dir="${build.home}/WEB-INF/lib">
<include name="**/*.jar" />
</fileset>
<!-- Include all elements that Tomcat exposes to applications -->
<pathelement location="${catalina.home}/common/classes"/>
<pathelement location="${catalina.home}/shared/classes"/>
<fileset dir="${catalina.home}/common/endorsed">
<include name="*.jar"/>
</fileset>
<fileset dir="${catalina.home}/common/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${catalina.home}/shared/lib">
<include name="*.jar"/>
</fileset>
</path>
<!-- Compile Java classes as necessary -->
<javac srcdir="${src.home}"
destdir="${build.home}/WEB-INF/classes"
debug="${compile.debug}"
nowarn="${compile.warn}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
<classpath refid="compile.classpath"/>
</javac>
<!-- Copy application resources -->
<copy todir="${build.home}/WEB-INF/classes">
<fileset dir="${src.home}" excludes="**/*.java,**/*.jad"/>
</copy>
</target>
<!-- ==================== wsdl2java ===================================== -->
<target name="wsdl2java" depends="prepare">
<!-- <property name="WSDL" value="${basedir}/dime2.wsdl"/> -->
<property name="WSDL" value="${basedir}/swa_1.wsdl"/>
<path id="wsdl.classpath">
<pathelement location="${build.home}/WEB-INF/classes"/>
<fileset dir="${build.home}/WEB-INF/lib">
<include name="*.jar" />
</fileset>
</path>
<taskdef resource="axis-tasks.properties" classpathref="wsdl.classpath" />
<axis-wsdl2java
deployScope="Session"
output="${src.home}"
helpergen="false"
typemappingversion="1.1"
verbose="true"
serverside="true"
skeletonDeploy="true"
url="${WSDL}"
>
<!-- testcase="true" -->
<mapping
namespace="http://com.lmtas.swa.services"
package="com.lmtas.swa.services"/>
</axis-wsdl2java>
</target>
<!-- ==================== clientstubs =================================== -->
<target name="clientstubs" depends="prepare">
<path id="wsdl.classpath">
<pathelement location="${build.home}/WEB-INF/classes"/>
<fileset dir="${build.home}/WEB-INF/lib">
<include name="**/*.jar" />
</fileset>
</path>
<taskdef resource="axis-tasks.properties" classpathref="wsdl.classpath" />
<!--
url="http://localhost:8080/swa/services/JerichoDataServicePort?wsdl"
-->
<axis-wsdl2java
output="${src.home}"
url="${basedir}/swa_1.wsdl"
verbose="true">
<mapping
namespace="http://com.lmtas.swa.services"
package="com.lmtas.swa.client" />
</axis-wsdl2java>
</target>
<!-- ==================== Run Client ================================== -->
<target name="run" depends="compile" description="Compile Java sources">
<path id="run.classpath">
<pathelement location="${build.home}/WEB-INF/classes"/>
<fileset dir="${build.home}/WEB-INF/lib">
<include name="**/*.jar" />
</fileset>
</path>
<!-- Java -->
<java classname="swaClientTest"
fork="yes">
<classpath refid="run.classpath"/>
</java>
</target>
<!-- ==================== Dist Target ===================================== -->
<!--
The "dist" target creates a binary distribution of your application
in a directory structure ready to be archived in a tar.gz or zip file.
Note that this target depends on two others:
* "compile" so that the entire web application (including external
dependencies) will have been assembled
* "javadoc" so that the application Javadocs will have been created
-->
<target name="dist" depends="compile,javadoc" description="Create binary distribution">
<!-- Copy documentation subdirectories -->
<mkdir dir="${dist.home}/docs"/>
<copy todir="${dist.home}/docs">
<fileset dir="${docs.home}"/>
</copy>
<!-- Create application JAR file -->
<jar jarfile="${dist.home}/${app.name}${app.version}.war"
basedir="${build.home}"
excludes="**/generated/**"/>
<!-- Copy additional files to ${dist.home} as necessary -->
<copy file="${dist.home}/${app.name}${app.version}.war"
todir="c:/java/Tomcat 5.0/webapps"/>
<!-- Copy class files to ${dist.home} as necessary -->
<copy todir="c:/java/Tomcat 5.0/webapps/${app.name}/WEB-INF/classes">
<fileset dir="${build.home}/WEB-INF/classes"/>
</copy>
</target>
<!-- ==================== Install Target ================================== -->
<!--
The "install" target tells the specified Tomcat 5 installation to dynamically
install this web application and make it available for execution. It does
*not* cause the existence of this web application to be remembered across
Tomcat restarts; if you restart the server, you will need to re-install all
this web application.
If you have already installed this application, and simply want Tomcat to
recognize that you have updated Java classes (or the web.xml file), use the
"reload" target instead.
NOTE: This target will only succeed if it is run from the same server that
Tomcat is running on.
NOTE: This is the logical opposite of the "remove" target.
localWar="file://${build.home}"/>
-->
<target name="install" depends="compile" description="Install application to servlet container">
<deploy url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"
war="${dist.home}/${app.name}-${app.version}.war"/>
</target>
<!-- ==================== Javadoc Target ================================== -->
<!--
The "javadoc" target creates Javadoc API documentation for the Java
classes included in your application. Normally, this is only required
when preparing a distribution release, but is available as a separate
target in case the developer wants to create Javadocs independently.
-->
<target name="javadoc" depends="compile" description="Create Javadoc API documentation">
<mkdir dir="${dist.home}/docs/api"/>
<!-- HRF SKIP THIS FOR NOW
<javadoc sourcepath="${src.home}"
destdir="${dist.home}/docs/api"
packagenames="*"
breakiterator="yes">
<classpath refid="compile.classpath"/>
</javadoc>
-->
</target>
<!-- ====================== List Target =================================== -->
<!--
The "list" target asks the specified Tomcat 5 installation to list the
currently running web applications, either loaded at startup time or
installed dynamically. It is useful to determine whether or not the
application you are currently developing has been installed.
-->
<target name="list"
description="List installed applications on servlet container">
<list url="${manager.url}"
username="${manager.username}"
password="${manager.password}"/>
</target>
<!-- ==================== Prepare Target ================================== -->
<!--
The "prepare" target is used to create the "build" destination directory,
and copy the static contents of your web application to it. If you need
to copy static files from external dependencies, you can customize the
contents of this task.
Normally, this task is executed indirectly when needed.
-->
<target name="prepare">
<!-- Create build directories as needed -->
<mkdir dir="${build.home}"/>
<mkdir dir="${build.home}/WEB-INF"/>
<mkdir dir="${build.home}/WEB-INF/classes"/>
<mkdir dir="${build.home}/WEB-INF/lib"/>
<!-- Copy static content of this web application -->
<copy todir="${build.home}">
<fileset dir="${web.home}"/>
</copy>
</target>
<!-- ==================== Reload Target =================================== -->
<!--
The "reload" target tells the specified Tomcat 5 installation to dynamically
reload this web application, to reflect changes in the underlying classes or
the "web.xml" deployment descriptor.
-->
<target name="reload" depends="compile"
description="Reload application on servlet container">
<reload url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"/>
</target>
<!-- ==================== Remove Target =================================== -->
<!--
The "remove" target tells the specified Tomcat 5 installation to dynamically
remove this web application from service.
NOTE: This is the logical opposite of the "install" target.
-->
<target name="remove"
description="Remove application on servlet container">
<undeploy url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"/>
</target>
</project>
catalina.home=C:/java/Tomcat 5.0
manager.username=
manager.password=
compile.debug=true
compile.warn=true
compile.deprecation=true
compile.optimize=true
