In the last message, I forgot to include the Java code example. We tried
both Xmlcursor and Xmloptions to remove the xmlns="" for d09 and the xmlns
for d0904, but could not get that to work. Here it is:
EMSDemographicDataSet emsDemographicDataSet =
EMSDemographicDataSet.Factory.newInstance();
D09[] d09Array = new D09[1];
D09 d09 = D09.Factory.newInstance();
String d0904 = "Stuff";
d09.setD0904(d0904);
Enum status = Enum.forString("A");
Calendar date = Calendar.getInstance();
d09.setStatus(status);
d09.setDate(date);
d09Array[0] = d09;
emsDemographicDataSet.setD09Array(d09Array);
if (emsDemographicDataSet != null) {
XmlCursor c = emsDemographicDataSet.newCursor();
c.toNextToken();
String schemaLocationURL =
"http://www.nemsis.org/media/XSD/EMSDemographicDataSet.xsd";
String namespace="http://www.nemsis.org";
c.insertNamespace("xsi",
"http://www.w3.org/2001/XMLSchema-instance");
c.insertAttributeWithValue(new
QName("http://www.w3.org/2001/XMLSchema-instance",
"schemaLocation", "xsi"),
namespace + " " + schemaLocationURL);
DemographicsPayload DEMOPayload =
DemographicsPayload.Factory.newInstance();
DEMOPayload.setEMSDemographicDataSet(emsDemographicDataSet );
ExportDEMOResponse exportDEMOResponse =
ExportDEMOResponse.Factory.newInstance();
exportDEMOResponse.setReturn(DEMOPayload);
DEMOResponseDocument =
ExportDEMOResponseDocument.Factory.newInstance();
DEMOResponseDocument.setExportDEMOResponse(exportDEMOResponse);
}
return (DEMOResponseDocument);
> We have been running into a wall on this problem for about two weeks
> (everything else in our system works), so I thought I would throw it out
> to the community. We have created a web service with several operations.
> One operation returns an XML document that is defined by an XSD associated
> with a standard. We can not change the XSD for the standard, but can if
> necessary change our WSDL that references it or the Java code that
> dynamically constructs the XML payload/SOAP. We use Axis2, the XML Beans
> tools, and WSDL2Java to generate the Java classes to construct the XML.
> For this newsgroup, we created a simple example of an XML schema and WSDL
> (only a simplified version of one operation) that replicates the same
> problem, but much less complex.
>
> The namespaces in the payload corresponding to the standard need to be as
> if it was a standalone XML document.
>
> 1. SOAP Message
> The actual SOAP message produced by our system looks like this:
>
> <exportDEMOResponse xmlns="http://PolarisWS.ws4.ems.cognitech.com/types"
> xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
> <return>
> <EMSDemographicDataSet xsi:schemaLocation="http://www.nemsis.org
> http://www.nemsis.org/media/XSD/EMSDemographicDataSet.xsd"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="http://www.nemsis.org">
> <D09 Status="A" Date="2007-03-29-07:00" xmlns="">
>
> <D09_04 xmlns="http://www.nemsis.org">Stuff</D09_04>
> </D09>
> </EMSDemographicDataSet>
> </return>
> </exportDEMOResponse>
>
> 2. Desired SOAP Message/XML Document
> We would like the payload corresponding to Test.xsd (defined later in this
> message) to look like the following:
>
> <EMSDemographicDataSet xsi:schemaLocation="http://www.nemsis.org
> http://www.nemsis.org/media/XSD/EMSDemographicDataSet.xsd"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="http://www.nemsis.org">
> <D09 Status="A" Date="2007-03-29-07:00">
>
> <D09_04>Stuff</D09_04>
> </D09>
> </EMSDemographicDataSet>
>
> In other words, we want to get rid of the xmlns="" associated with D09 and
> the xmlns="http://www.nemsis.org" associated with D09_04. The xmlns=""
> only occurs when attributes are defined.
>
>
> 3. WSDL
> Our WSDL looks like this. Note that the elementFormDefault is qualified
> and the attributeFormDefault is unqualified.
> WSDL (services.wsdl)
>
> <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
> xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
> xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
> xmlns:ns1="http://PolarisWS.ws4.ems.cognitech.com/types"
> xmlns:ns="http://PolarisWS.ws4.ems.cognitech.com"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> targetNamespace="http://PolarisWS.ws4.ems.cognitech.com">
>
>
>
> <wsdl:types>
>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
> xmlns:types="http://PolarisWS.ws4.ems.cognitech.com/types"
>
> targetNamespace="http://PolarisWS.ws4.ems.cognitech.com/types"
> elementFormDefault="qualified"
> attributeFormDefault="unqualified"
> xmlns:Q1="http://www.nemsis.org">
> <xs:import schemaLocation="Test.xsd"
> namespace="http://www.nemsis.org">
> </xs:import>
>
> <xs:complexType name="DemographicsPayload">
> <xs:sequence>
> <xs:element ref="Q1:EMSDemographicDataSet" />
> </xs:sequence>
> </xs:complexType>
>
>
> <xs:element name="exportDEMO">
> <xs:complexType>
> <xs:sequence>
> <xs:element type="xs:string"
> name="agencyID" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
>
> <xs:element name="exportDEMOResponse">
> <xs:complexType>
> <xs:sequence>
> <xs:element
> type="types:DemographicsPayload"
> name="return" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
>
>
> </xs:schema>
> </wsdl:types>
>
> <wsdl:message name="exportDEMOMessage">
> <wsdl:part element="ns1:exportDEMO" name="part1" />
> </wsdl:message>
>
> <wsdl:message name="exportDEMOResponseMessage">
> <wsdl:part element="ns1:exportDEMOResponse" name="part1" />
> </wsdl:message>
>
>
> <wsdl:portType name="PolarisWSPortType">
>
> <wsdl:operation name="exportDEMO">
> <wsdl:input message="ns:exportDEMOMessage" />
> <wsdl:output message="ns:exportDEMOResponseMessage" />
> </wsdl:operation>
>
>
> </wsdl:portType>
>
> <wsdl:binding type="ns:PolarisWSPortType"
> name="PolarisWSSOAP11Binding">
> <soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http" />
>
> <wsdl:operation name="exportDEMO">
> <soap:operation style="document"
> soapAction="urn:exportDEMO" />
> <wsdl:input>
> <soap:body
>
> namespace="http://PolarisWS.ws4.ems.cognitech.com" use="literal" />
> </wsdl:input>
> <wsdl:output>
> <soap:body
>
> namespace="http://PolarisWS.ws4.ems.cognitech.com" use="literal" />
> </wsdl:output>
> </wsdl:operation>
>
>
> </wsdl:binding>
>
> <wsdl:binding type="ns:PolarisWSPortType"
> name="PolarisWSSOAP12Binding">
> <soap12:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http" />
>
>
> <wsdl:operation name="exportDEMO">
> <soap12:operation style="document"
> soapAction="urn:exportDEMO" />
> <wsdl:input>
> <soap12:body
>
> namespace="http://PolarisWS.ws4.ems.cognitech.com" use="literal" />
> </wsdl:input>
>
> <wsdl:output>
> <soap12:body
>
> namespace="http://PolarisWS.ws4.ems.cognitech.com" use="literal" />
> </wsdl:output>
>
> </wsdl:operation>
>
> </wsdl:binding>
>
> <wsdl:service name="PolarisWS">
> <wsdl:port binding="ns:PolarisWSSOAP11Binding"
> name="PolarisWSSOAP11port">
> <soap:address
>
> location="http://localhost:8080/axis2/services/PolarisWS" />
> </wsdl:port>
>
> <wsdl:port binding="ns:PolarisWSSOAP12Binding"
> name="PolarisWSSOAP12port">
> <soap12:address
>
> location="http://localhost:8080/axis2/services/PolarisWS" />
> </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>
>
>
> 4. XSD File Referenced by WSDL
> Our Test.xsd file is a very simplified version of the standard (about few
> fields vs. several thousand). Note that the elementFormDefault is
> qualified and the attributeFormDefault is unqualified. We can not change
> the actual standard.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns="http://www.nemsis.org"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://www.nemsis.org" elementFormDefault="qualified"
> attributeFormDefault="unqualified">
> <xs:annotation>
> <xs:appinfo>
> <schema xmlns="http://www.ascc.net/xml/schematron">
> <title>Meds</title>
> <ns uri="http://www.nemsis.org" prefix="ns"/>
> <pattern name="Medications">
> <rule context="ns:E18">
> <assert
> test="preceding::E18_02">
> If <name/> is used you must list the Medications listed
> </assert>
> <assert
> test="preceding::E18_07">
> If <name/> is used you must list the patient response
> </assert>
> </rule>
> <rule context="ns:Header">
> <report test="count(ns:Record)
> > 0">
> There are <value-of select =
> "count(ns:Header\Record)"/> <name/>
> </report>
> </rule>
> </pattern>
> </schema>
> </xs:appinfo>
> </xs:annotation>
>
> <xs:complexType name="D09" id="MedicalDeviceInformation">
> <xs:sequence>
>
>
> <xs:element name="D09_04" type="ModelNumber"
> minOccurs="0">
> <xs:annotation>
> <xs:documentation>The specific
> manufacturer's model number associated
> with medical device.</xs:documentation>
> </xs:annotation>
> </xs:element>
> <xs:element name="D09_05" type="Date" minOccurs="0">
> <xs:annotation>
> <xs:documentation>The year the device
> was purchased by the EMS agency
> or the date the status changed.</xs:documentation>
> </xs:annotation>
> </xs:element>
> </xs:sequence>
> <xs:attributeGroup ref="currentStatus"/>
> </xs:complexType>
>
>
> <xs:element name="EMSDemographicDataSet">
> <xs:annotation>
> <xs:documentation>Root Tag For
> Dataset</xs:documentation>
> </xs:annotation>
> <xs:complexType>
> <xs:sequence>
> <xs:element name="D09" type="D09" minOccurs="0"
> maxOccurs="unbounded">
> <xs:annotation>
> <xs:documentation>Section D9
> Medical Device
> Information"</xs:documentation>
> </xs:annotation>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
>
>
>
>
>
>
> <xs:attributeGroup name="currentStatus">
> <xs:annotation>
> <xs:documentation>Attribute group used to define the
> current status of
> an element value and the date the status was
> confirmed</xs:documentation>
> </xs:annotation>
> <xs:attribute name="Status" type="Status" use="required"/>
> <xs:attribute name="Date" type="Date" use="required"/>
> </xs:attributeGroup>
> <xs:simpleType name="Date">
> <xs:annotation>
> <xs:documentation>The corresponding
> date</xs:documentation>
> </xs:annotation>
> <xs:restriction base="xs:date">
> <xs:minInclusive value="1920-01-01"/>
> <xs:maxInclusive value="2030-01-01"/>
> </xs:restriction>
> </xs:simpleType>
> <xs:simpleType name="DateTime">
> <xs:annotation>
> <xs:documentation>The date/time the injury occurred, or
> the date/time
> the symptoms or problem started</xs:documentation>
> </xs:annotation>
> <xs:restriction base="xs:dateTime">
> <xs:minInclusive value="1990-01-01T00:00:00"/>
> <xs:maxInclusive value="2030-01-01T00:00:00-05:00"/>
> </xs:restriction>
> </xs:simpleType>
>
>
>
>
>
> <xs:simpleType name="ModelNumber">
> <xs:annotation>
> <xs:documentation>The specific manufacturer's model
> number associated
> with medical device.</xs:documentation>
> </xs:annotation>
> <xs:restriction base="xs:string">
> <xs:minLength value="2"/>
> <xs:maxLength value="50"/>
> </xs:restriction>
> </xs:simpleType>
> <xs:simpleType name="NullDate">
> <xs:annotation>
> <xs:documentation>The corresponding
> date</xs:documentation>
> </xs:annotation>
> <xs:union memberTypes="NullValues">
> <xs:simpleType>
> <xs:restriction base="xs:date">
> <xs:minInclusive value="1990-01-01"/>
> <xs:maxInclusive value="2030-01-01"/>
> </xs:restriction>
> </xs:simpleType>
> </xs:union>
> </xs:simpleType>
> <xs:simpleType name="NullValues">
> <xs:annotation>
> <xs:documentation>The Values used to describe Null
> fieldsd</xs:documentation>
> </xs:annotation>
> <xs:restriction base="xs:integer">
> <xs:enumeration value="-5">
> <xs:annotation>
> <xs:documentation>Not
> Available</xs:documentation>
> </xs:annotation>
> </xs:enumeration>
> <xs:enumeration value="-10">
> <xs:annotation>
> <xs:documentation>Not
> Known</xs:documentation>
> </xs:annotation>
> </xs:enumeration>
> <xs:enumeration value="-15">
> <xs:annotation>
> <xs:documentation>Not
> Reporting</xs:documentation>
> </xs:annotation>
> </xs:enumeration>
> <xs:enumeration value="-20">
> <xs:annotation>
> <xs:documentation>Not
> Recorded</xs:documentation>
> </xs:annotation>
> </xs:enumeration>
> <xs:enumeration value="-25">
> <xs:annotation>
> <xs:documentation>Not
> Applicable</xs:documentation>
> </xs:annotation>
> </xs:enumeration>
> </xs:restriction>
> </xs:simpleType>
>
>
>
>
> <xs:simpleType name="Status">
> <xs:annotation>
> <xs:documentation>The Status either active or
> inactive</xs:documentation>
> </xs:annotation>
> <xs:restriction base="xs:string">
> <xs:enumeration value="A">
> <xs:annotation>
>
> <xs:documentation>Active</xs:documentation>
> </xs:annotation>
> </xs:enumeration>
> <xs:enumeration value="I">
> <xs:annotation>
>
> <xs:documentation>Inactive</xs:documentation>
> </xs:annotation>
> </xs:enumeration>
> </xs:restriction>
> </xs:simpleType>
> </xs:schema>
>
>
>
> Any help is appreciated.
>
> Jerome Soller, PhD
> President, CogniTech Corporation
> Salt Lake City, Utah
> e-mail: [EMAIL PROTECTED]
> Phone: (801) 322-0101
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]