You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Jerome Soller (JIRA)" <ji...@apache.org> on 2007/04/20 20:40:15 UTC
[jira] Commented: (AXIS2-2488) Bug on Namespaces, xmlns=""
[ https://issues.apache.org/jira/browse/AXIS2-2488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12490421 ]
Jerome Soller commented on AXIS2-2488:
--------------------------------------
Davanum and Amila,
Thankyou for the update on the JIRA bug that I posted, as this is a
critical issue for our upcoming release of emergency medical software
for the State of Utah. I realize that both of you are volunteers.
Since this is the only Apache bug report I have submitted, I don't
fully understand the process. In general, how long long does it take
to resolve critical bugs? From your experience and knowledge of the
Axis 2 code, do you have any thoughts on this specific bug?
Your assistance and dedication is greatly appreciated.
Sincerely,
Jerome Soller
> Bug on Namespaces, xmlns=""
> ---------------------------
>
> Key: AXIS2-2488
> URL: https://issues.apache.org/jira/browse/AXIS2-2488
> Project: Axis 2.0 (Axis2)
> Issue Type: Bug
> Affects Versions: 1.2
> Environment: Same behavior on both Windows and Linux servers. Tomcat 5.0 is our app server.
> Reporter: Jerome Soller
> Assigned To: Amila Chinthaka Suriarachchi
>
> 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. 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.
> 1. XML Constructed
> The XML constructed by XMLBeans before its return is as follows:
> <exportDEMOResponse
> xmlns="http://PolarisWS.ws4.ems.cognitech.com/types">
> <return>
> <nem: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:nem="http://www.nemsis.org">
> <nem:D09 Status="A" Date="2007-04-04-06:00">
> <nem:D09_04>Stuff</nem:D09_04>
> </nem:D09>
> </nem:EMSDemographicDataSet>
> </return>
> </exportDEMOResponse>
> 2. SOAP Message
> The actual SOAP message received by the web services client (simple
> example) 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>
> 3. Desired SOAP Message/XML Document
> We would like the payload corresponding to Test.xsd (defined later in this
> message) to look something 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.
> 4. WSDL
> Our WSDL looks like this. Note that the elementFormDefault is qualified
> and the attributeFormDefault is unqualified. We can change the WSDL if
> that would fix the problem.
> 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>
> 5. 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 XSD standard, but we can change the WSDL.
> <?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>
> 6. Source Code:
> public com.cognitech.ems.ws4.polarisws.types.ExportDEMOResponseDocument
> exportDEMO
> (
> com.cognitech.ems.ws4.polarisws.types.ExportDEMODocument param32
> )
> {
> ExportDEMOResponseDocument DEMOResponseDocument = null;
> ExportDEMO exportDemo = param32.getExportDEMO();
> String agencyID = exportDemo.getAgencyID();
> 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);
> ExportDEMOResponseDocument.ExportDEMOResponse
> exportDEMOResponse =
> ExportDEMOResponseDocument.ExportDEMOResponse.Factory.newInstance();
> exportDEMOResponse.setReturn(DEMOPayload);
> //System.out.println("\n DemoPayload: " +
> DEMOPayload.xmlText(xo));
> DEMOResponseDocument =
> ExportDEMOResponseDocument.Factory.newInstance();
> DEMOResponseDocument.setExportDEMOResponse(exportDEMOResponse);
> XmlOptions xo = new XmlOptions().setSavePrettyPrint();
> xo.setUseDefaultNamespace();
> ArrayList errors = new ArrayList();
> xo.setErrorListener(errors);
> System.out.println("\nEMSMOD: " +
> DEMOResponseDocument.xmlText(xo));
> if (!DEMOResponseDocument.validate(xo)) {
> for (int i = 0; i < errors.size(); i++) {
> System.out.println("Validation error");
> }
> }
> System.out.println("Done with the server-side version");
> }
> return (DEMOResponseDocument);
> }
> 7. services.xml file
> This can be posted if necessary
> Jerome Soller, PhD
> President, CogniTech Corporation
> Salt Lake City, Utah
> e-mail: soller@cognitech-ut.com
> Phone: (801) 322-0101
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org