I am trying to generate a webservice client from a wsdl. I am not sure whats wrong with the WSDL. Any help is appreciated!...
Below is the error message:
[echo] Generating jpl_farmersfinance's WSDL stub classes for WSDL 'client_1'.
[java] Retrieving document at 'C:/ISH_Code/jpl_1134/source/jpl_farmersfinance/staticfiles/wsdl/getPaymentStatus.wsdl'.
[java] Retrieving schema at 'getPaymentStatus.xsd', relative to 'file:/C:/ISH_Code/jpl_1134/source/jpl_farmersfinance/staticfiles/wsdl/getPaymentStatus.wsdl'.
[java] Retrieving schema at 'Envelope.xsd', relative to 'file:/C:/ISH_Code/jpl_1134/source/jpl_farmersfinance/staticfiles/wsdl/getPaymentStatus.wsdl'.
[java] Retrieving schema at 'ApplicationError.xsd', relative to 'file:/C:/ISH_Code/jpl_1134/source/jpl_farmersfinance/staticfiles/wsdl/getPaymentStatus.wsdl'.
[java] [2016-05-26 14:00:24.001 EST] [main] INFO o.a.a.xmlbeans.CodeGenerationUtility - Resolving schema with publicId [http://paymentsystem.fpf.co.nz/] and systemId [getPaymentStatus.xsd]
[java] [2016-05-26 14:00:24.046 EST] [main] INFO o.a.a.xmlbeans.CodeGenerationUtility - Resolving schema with publicId [http://schemas.xmlsoap.org/soap/envelope/] and systemId [Envelope.xsd]
[java] [2016-05-26 14:00:24.065 EST] [main] INFO o.a.a.xmlbeans.CodeGenerationUtility - Resolving schema with publicId [http://paymentsystem.fpf.co.nz/] and systemId [ApplicationError.xsd]
[java] Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException: Element QName is null for getPaymentStatus_ApplicationErrorMessage!
[java] at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:293)
[java] at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
[java] at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
[java] Caused by: org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException: Element QName is null for getPaymentStatus_ApplicationErrorMessage!
[java] at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.emitStub(AxisServiceBasedMultiLanguageEmitter.java:537)
[java] at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:282)
[java] ... 2 more
[java] Caused by: java.lang.RuntimeException: Element QName is null for getPaymentStatus_ApplicationErrorMessage!
[java] at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.getFaultParamElements(AxisServiceBasedMultiLanguageEmitter.java:2925)
[java] at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.getFaultElement(AxisServiceBasedMultiLanguageEmitter.java:2844)
[java] at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.generateMethodElement(AxisServiceBasedMultiLanguageEmitter.java:2366)
[java] at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.loadOperations(AxisServiceBasedMultiLanguageEmitter.java:2242)
[java] at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.createDOMDocumentForCallbackHandler(AxisServiceBasedMultiLanguageEmitter.java:1232)
[java] at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.writeCallBackHandlers(AxisServiceBasedMultiLanguageEmitter.java:1198)
[java] at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.emitStub(AxisServiceBasedMultiLanguageEmitter.java:460)
[java] ... 3 more
WSDL
<?xml version="1.0" encoding="UTF-8"?>
<WL5G3N0:definitions name="GetPaymentStatus" targetNamespace="http://paymentsystem.fpf.co.nz/" xmlns:WL5G3N0="http://schemas.xmlsoap.org/wsdl/" xmlns:WL5G3N1="http://paymentsystem.fpf.co.nz/" xmlns:WL5G3N2="http://schemas.xmlsoap.org/soap/envelope/" xmlns:WL5G3N3="http://schemas.xmlsoap.org/wsdl/soap/">
<WL5G3N0:documentation>rd_20141210_v3_bd_20141201_ltfo</WL5G3N0:documentation>
<WL5G3N0:types>
<xsd:schema xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://paymentsystem.fpf.co.nz/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsp1_3="http://paymentsystem.fpf.co.nz/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://paymentsystem.fpf.co.nz/" schemaLocation="getPaymentStatus.xsd"/>
<xsd:import namespace="http://schemas.xmlsoap.org/soap/envelope/" schemaLocation="Envelope.xsd"/>
</xsd:schema>
<xsd:schema xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://paymentsystem.fpf.co.nz/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsp1_3="http://paymentsystem.fpf.co.nz/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://paymentsystem.fpf.co.nz/" schemaLocation="ApplicationError.xsd"/>
</xsd:schema>
</WL5G3N0:types>
<WL5G3N0:message name="getPaymentStatus">
<WL5G3N0:part element="WL5G3N1:getPaymentStatus" name="parameters"/>
</WL5G3N0:message>
<WL5G3N0:message name="getPaymentStatusResponse">
<WL5G3N0:part element="WL5G3N1:getPaymentStatusResponse" name="parameters"/>
</WL5G3N0:message>
<WL5G3N0:message name="getPaymentStatus_ApplicationErrorMessage">
<WL5G3N0:part element="WL5G3N1:ApplicationError" name="fault_ApplicationError"/>
</WL5G3N0:message>
<WL5G3N0:message name="getPaymentStatus_SystemErrorMessage">
<WL5G3N0:part element="WL5G3N1:SystemError" name="fault_SystemError"/>
</WL5G3N0:message>
<WL5G3N0:message name="getPaymentStatusFault">
<WL5G3N0:part element="WL5G3N2:Fault" name="fault"/>
</WL5G3N0:message>
<WL5G3N0:portType name="PaymentStatusWS">
<WL5G3N0:operation name="getPaymentStatus">
<WL5G3N0:input message="WL5G3N1:getPaymentStatus"/>
<WL5G3N0:output message="WL5G3N1:getPaymentStatusResponse"/>
<WL5G3N0:fault message="WL5G3N1:getPaymentStatus_ApplicationErrorMessage" name="ApplicationError"/>
<WL5G3N0:fault message="WL5G3N1:getPaymentStatus_SystemErrorMessage" name="SystemError"/>
<WL5G3N0:fault message="WL5G3N1:getPaymentStatusFault" name="fault"/>
</WL5G3N0:operation>
</WL5G3N0:portType>
<WL5G3N0:binding name="PaymentStatusWSPortBinding" type="WL5G3N1:PaymentStatusWS">
<WL5G3N3:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<WL5G3N0:operation name="getPaymentStatus">
<WL5G3N3:operation/>
<WL5G3N0:input>
<WL5G3N3:body use="literal"/>
</WL5G3N0:input>
<WL5G3N0:output>
<WL5G3N3:body use="literal"/>
</WL5G3N0:output>
<WL5G3N0:fault name="fault">
<WL5G3N3:fault name="fault" use="literal"/>
</WL5G3N0:fault>
</WL5G3N0:operation>
</WL5G3N0:binding>
<WL5G3N0:service name="PaymentStatusWS">
<WL5G3N0:documentation>OSB Service</WL5G3N0:documentation>
<WL5G3N0:port binding="WL5G3N1:PaymentStatusWSPortBinding" name="PaymentStatusWSPort">
<WL5G3N3:address location="https://ltfotst.rfs.co.nz:443/API/FpfPaymentSystem/getPaymentStatus"/>
</WL5G3N0:port>
</WL5G3N0:service>
</WL5G3N0:definitions>
ApplicationError.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://paymentsystem.fpf.co.nz/" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://paymentsystem.fpf.co.nz/">
<xsd:element name="ApplicationError" type="detail"/>
<xsd:element name="SystemError" type="detail"/>
<xsd:complexType name="detail">
<xsd:sequence>
<xsd:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</xsd:sequence>
<xsd:anyAttribute namespace="##any" processContents="lax"/>
</xsd:complexType>
</xsd:schema>
Envelope.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:element name="Envelope" type="tns:Envelope"/>
<xs:complexType name="Envelope">
<xs:sequence>
<xs:element ref="tns:Header" minOccurs="0"/>
<xs:element ref="tns:Body" minOccurs="1"/>
<xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</xs:sequence>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<xs:element name="Header" type="tns:Header"/>
<xs:complexType name="Header">
<xs:sequence>
<xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</xs:sequence>
<xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:complexType>
<xs:element name="Body" type="tns:Body"/>
<xs:complexType name="Body">
<xs:sequence>
<xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</xs:sequence>
<xs:anyAttribute namespace="##any" processContents="lax">
<xs:annotation>
<xs:documentation>Prose in the spec does not specify that attributes are allowed on the Body element</xs:documentation>
</xs:annotation>
</xs:anyAttribute>
</xs:complexType>
<!--Global Attributes. The following attributes are intended to be usable via qualified attribute names on any complex type referencing them.-->
<xs:attribute name="mustUnderstand">
<xs:simpleType>
<xs:restriction base="xs:boolean">
<xs:pattern value="0|1"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="actor" type="xs:anyURI"/>
<xs:simpleType name="encodingStyle">
<xs:annotation>
<xs:documentation>'encodingStyle' indicates any canonicalization conventions followed in the contents of the containing element. For example, the value 'http://schemas.xmlsoap.org/soap/encoding/' indicates the pattern described in SOAP specification</xs:documentation>
</xs:annotation>
<xs:list itemType="xs:anyURI"/>
</xs:simpleType>
<xs:attribute name="encodingStyle" type="tns:encodingStyle"/>
<xs:attributeGroup name="encodingStyle">
<xs:attribute ref="tns:encodingStyle"/>
</xs:attributeGroup>
<xs:element name="Fault" type="tns:Fault"/>
<xs:complexType name="Fault" final="extension">
<xs:annotation>
<xs:documentation>Fault reporting structure</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="faultcode" type="xs:QName"/>
<xs:element name="faultstring" type="xs:string"/>
<xs:element name="faultactor" type="xs:anyURI" minOccurs="0"/>
<xs:element name="detail" type="tns:detail" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="detail">
<xs:sequence>
<xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</xs:sequence>
<xs:anyAttribute namespace="##any" processContents="lax"/>
</xs:complexType>
</xs:schema>
getPaymentStatus.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://paymentsystem.fpf.co.nz/" xmlns:ns0="http://paymentsystem.fpf.co.nz/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="Result">
<xsd:sequence>
<xsd:element name="resultCode" type="xsd:string"/>
<xsd:element name="resultDesc" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="PaymentStatus">
<xsd:sequence>
<xsd:element name="statusCode" type="xsd:string"/>
<xsd:element name="statusDesc" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="PaymentStatusRequest">
<xsd:sequence>
<xsd:element name="user_id" type="xsd:int"/>
<xsd:element name="user_name" type="ns0:NotEmptyString"/>
<xsd:element name="user_password" type="ns0:NotEmptyString"/>
<xsd:element name="api_key" type="ns0:NotEmptyString"/>
<xsd:element name="voucherNo" type="xsd:int"/>
<xsd:element name="traceAuditNumber" type="ns0:NotEmptyString"/>
<xsd:element name="transmissionDateTime">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="(2[0-9][0-9][0-9])(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])(0[0-9]|[1-5][0-9])(0[0-9]|[1-5][0-9])"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="PaymentStatusResponse">
<xsd:sequence>
<xsd:element name="result" type="ns0:Result"/>
<xsd:element name="paymentStatus" type="ns0:PaymentStatus" minOccurs="0"/>
<xsd:element name="retrievalReferenceNumber" type="xsd:int" minOccurs="0"/>
<xsd:element name="traceAuditNumber" type="xsd:string"/>
<xsd:element name="transmissionDateTime" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="NotEmptyString">
<xsd:restriction base="xsd:string">
<xsd:pattern value="(\s*[^\s]\s*)+"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="getPaymentStatus" type="ns0:PaymentStatusRequest"/>
<xsd:element name="getPaymentStatusResponse" type="ns0:PaymentStatusResponse"/>
</xsd:schema>
Related
I have an xsd file such as :-
<?xml version="1.0" encoding="UTF-8"?>
<xsd:element xmlns:ns2="http://www.tibco.com/ns/no_namespace_schema_location/UnitTest/TestProcess-End.xsd"
xmlns:ns="http://www.tibco.com/ns/no_namespace_schema_location/UnitTest/TestProcess-Map Data.xsd"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:pd="http://xmlns.tibco.com/bw/process/2003"
xmlns:ns="http://www.tibco.com/namespaces/tnt/plugins/jms"
name="group">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="root">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="a" type="xsd:string" minOccurs="0"/>
<xsd:element name="b" type="xsd:string" minOccurs="0"/>
<xsd:element name="c" type="xsd:string" minOccurs="0"/>
<xsd:element name="d" type="xsd:string" minOccurs="0"/>
<xsd:element name="e" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element ref="ns:root"/>
<xsd:element ref="ns2:root"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
This contains some un used namespaces, can any one explain how to achieve it with xslt:-
the output desired is :- Please note the namespaces which are used for schema references should be entact.
<?xml version="1.0" encoding="UTF-8"?>
<xsd:element xmlns:ns2="http://www.tibco.com/ns/no_namespace_schema_location/UnitTest/TestProcess-End.xsd"
xmlns:ns="http://www.tibco.com/ns/no_namespace_schema_location/UnitTest/TestProcess-Map Data.xsd"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="group">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="root">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="a" type="xsd:string" minOccurs="0"/>
<xsd:element name="b" type="xsd:string" minOccurs="0"/>
<xsd:element name="c" type="xsd:string" minOccurs="0"/>
<xsd:element name="d" type="xsd:string" minOccurs="0"/>
<xsd:element name="e" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element ref="ns:root"/>
<xsd:element ref="ns2:root"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Use exclude-result-prefixes in xslt declaration
In XSLT 2.0, you can do <xsl:copy-of select="/" copy-namespaces="no"/> which will copy the entire document, excluding any namespaces that aren't used in element or attribute names. However, it might remove namespaces that are used only in attribute content, for example ref="ns2:root". Detecting those cases reliably is quite tricky, especially if they are used inside XPath expressions (e.g. in xs:key and xs:keyref constraints).
If you want to remove all "unused" namespaces except those in a $retain list, you could do something like (again XSLT 2.0):
<xsl:template match="*">
<xsl:copy copy-namespaces="no">
<xsl:copy-of select="#*"/>
<xsl:copy-of select="namespace::*[not(name()=$retain)]"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
and you could perhaps initialize $retain to contain all strings in the stylesheet that match [A-Za-z0-9]:, minus the colon.
I have a schema which is something like this:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" attributeFormDefault="unqualified" version="1.28.0">
<xsd:complexType name="AccountsReceivableInfo_Type">
<xsd:sequence>
<xsd:element ref="SourceIncomePct" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="DuplicateRecordsPct" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="id" type="ID"/>
<xsd:attribute name="Locationref" type="IDref"/>
</xsd:complexType>
<xsd:complexType name="AccountsDeleteInfo_Type">
<xsd:sequence>
<xsd:element ref="SourceIncomePct" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="DuplicateRecordsPct" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="id" type="ID"/>
<xsd:attribute name="Locationref" type="IDref"/>
</xsd:complexType>
and I am trying to modify it and write an XSLT script to:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" attributeFormDefault="unqualified" version="1.28.0">
<xsd:complexType name="AccountsReceivableInfo_Type">
<xsd:sequence>
<!--<xsd:element ref="SourceIncomePct" minOccurs="0" maxOccurs="1"/>-->
<xsd:element ref="DuplicateRecordsPct" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="id" type="ID"/>
<xsd:attribute name="Locationref" type="IDref"/>
</xsd:complexType>
<xsd:complexType name="AccountsDeleteInfo_Type">
<xsd:sequence>
<xsd:element ref="SourceIncomePct" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="DuplicateRecordsPct" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="id" type="ID"/>
<xsd:attribute name="Locationref" type="IDref"/>
</xsd:complexType>
XSLT script which i wrote so far is
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:transform version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="xsd:complexType[#name='AccountsReceivableInfo_Type']
/xsd:element[#ref ='SourceIncomePct']">
<xsl:text disable-output-escaping="yes"><!--</xsl:text>
<xsl:sequence select="."/>
<xsl:text disable-output-escaping="yes">--></xsl:text>
</xsl:template>
<xsl:template match="#*|node()">
<xsl:copy><xsl:apply-templates select="#*|node()"/></xsl:copy>
</xsl:template>
</xsl:transform>
What I am trying to do is to modify a big schema like above and automate it and need to read a particular element within a particular complextype parent and modify only that instance like commenting it out.
If you want to put the element into a comment consider to move to XSLT 3.0 and use
<xsl:template match="xsd:complexType[#name='AccountsReceivableInfo_Type']/xsd:sequence/xsd:element[#ref ='SourceIncomePct']">
<xsl:comment select="serialize(.)"/>
</xsl:template>
I have a wsdl file without binding section:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<wsdl:definitions xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Engage" targetNamespace="http://tempuri.org/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<xs:element name="OtherData">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="id" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="OtherDataResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="OtherDataResult" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="MyData">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="id" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="MyDataResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="MyDataResult" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<xs:schema xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/">
<xs:element name="anyType" nillable="true" type="xs:anyType" />
<xs:element name="anyURI" nillable="true" type="xs:anyURI" />
<xs:element name="base64Binary" nillable="true" type="xs:base64Binary" />
<xs:element name="boolean" nillable="true" type="xs:boolean" />
<xs:element name="byte" nillable="true" type="xs:byte" />
<xs:element name="dateTime" nillable="true" type="xs:dateTime" />
<xs:element name="decimal" nillable="true" type="xs:decimal" />
<xs:element name="double" nillable="true" type="xs:double" />
<xs:element name="float" nillable="true" type="xs:float" />
<xs:element name="int" nillable="true" type="xs:int" />
<xs:element name="long" nillable="true" type="xs:long" />
<xs:element name="QName" nillable="true" type="xs:QName" />
<xs:element name="short" nillable="true" type="xs:short" />
<xs:element name="string" nillable="true" type="xs:string" />
<xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte" />
<xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt" />
<xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong" />
<xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort" />
<xs:element name="char" nillable="true" type="tns:char" />
<xs:simpleType name="char">
<xs:restriction base="xs:int" />
</xs:simpleType>
<xs:element name="duration" nillable="true" type="tns:duration" />
<xs:simpleType name="duration">
<xs:restriction base="xs:duration">
<xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?" />
<xs:minInclusive value="-P10675199DT2H48M5.4775808S" />
<xs:maxInclusive value="P10675199DT2H48M5.4775807S" />
</xs:restriction>
</xs:simpleType>
<xs:element name="guid" nillable="true" type="tns:guid" />
<xs:simpleType name="guid">
<xs:restriction base="xs:string">
<xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}" />
</xs:restriction>
</xs:simpleType>
<xs:attribute name="FactoryType" type="xs:QName" />
<xs:attribute name="Id" type="xs:ID" />
<xs:attribute name="Ref" type="xs:IDREF" />
</xs:schema>
</wsdl:types>
<wsdl:message name="IMyService_OtherData_InputMessage">
<wsdl:part element="tns:OtherData" name="parameters" />
</wsdl:message>
<wsdl:message name="IMyService_OtherData_OutputMessage">
<wsdl:part element="tns:OtherDataResponse" name="parameters" />
</wsdl:message>
<wsdl:message name="IMyService_MyData_InputMessage">
<wsdl:part element="tns:MyData" name="parameters" />
</wsdl:message>
<wsdl:message name="IMyService_MyData_OutputMessage">
<wsdl:part element="tns:MyDataResponse" name="parameters" />
</wsdl:message>
<wsdl:portType name="IMyService">
<wsdl:operation name="OtherData">
<wsdl:input message="tns:IMyService_OtherData_InputMessage" wsaw:Action="http://tempuri.org/IMyService/OtherData" />
<wsdl:output message="tns:IMyService_OtherData_OutputMessage" wsaw:Action="http://tempuri.org/IMyService/OtherDataResponse" />
</wsdl:operation>
<wsdl:operation name="MyData">
<wsdl:input message="tns:IMyService_MyData_InputMessage" wsaw:Action="http://tempuri.org/IMyService/MyData" />
<wsdl:output message="tns:IMyService_MyData_OutputMessage" wsaw:Action="http://tempuri.org/IMyService/MyDataResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:service name="MyService">
<wsdl:port name="xmlPort">
<http:address location="http://localhost:59109/MyService.svc/xml" />
</wsdl:port>
<wsdl:port name="jsonPort">
<http:address location="http://localhost:59109/MyService.svc/json" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Is this wsdl valid? Or in other words can we have wsdl without a binding section or it is required and this wsdl is invalid? Some tools (like SoapUI) throws exception but the other (like this https://www.wsdl-analyzer.com/) says that this is valid wsdl.
According to the W3C note about WSDL 1.1:
There may be any number of bindings for a given portType
Does it mean there can be no bindings?
Well, taking look at the XML schema for WSDL 1.1, binding element can have no occurences at all.
The practical behavior probably depends on a SOAP library. Note that the binding specifies whether we use document or RFC-style call and whether we encode the data or not.
I'm making a contract first webservice so my first xds(MensajeDetails.xds) is:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://webservices.samples.blog.com" targetNamespace="http://webservices.samples.blog.com" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="Mensaje" type="Mensaje"/>
<xs:complexType name="Mensaje">
<xs:sequence>
<xs:element name="IdMensajesEnviados" type="xs:long"/>
<xs:element name="CodigoEstatus" type="xs:int"/>
<xs:element name="DescripcionEstatus" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
and in my 2nd xds (MensajeDetailsServiceOperation.xds) I´ve:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://com/blog/samples/webservices/mensajeservice" xmlns:account="http://webservices.samples.blog.com" targetNamespace="http://com/blog/samples/webservices/mensajeservice" elementFormDefault="qualified">
<xsd:import namespace="http://webservices.samples.blog.com" schemaLocation="MensajeDetails.xsd"/>
<xsd:element name="MensajeDetailsRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="IdUsuario" type="xsd:long"/>
<xsd:element name="Token" type="xsd:string"/>
<xsd:element name="IdServicio" type="xsd:int"/>
<xsd:element name="Archivo" type="xsd:byte"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="MensajeDetailsResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="MensajeDetails" type="mensaje:Mensaje"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
So eclipse is telling me that in my 2nd xds
s4s-att-invalid-value: Invalid attribute value for 'type' in element 'element'.
Recorded reason: UndeclaredPrefix: Cannot resolve 'mensaje:Mensaje' as a QName: the prefix 'mensaje' is not declared." in the line:
<xsd:element name="MensajeDetails" type="mensaje:Mensaje"/>
What am I doing wrong?
You have imported the namespace into your schema and have declared a namespace prefix for it, in your schema declaration your have xmlns:account="http://webservices.samples.blog.com", this binds the prefix "account" to your imported namespace.
So, either change your element to account:Mensaje or change the prefix to mensaje
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://com/blog/samples/webservices/mensajeservice"
xmlns:mensaje="http://webservices.samples.blog.com"
targetNamespace="http://com/blog/samples/webservices/mensajeservice"
elementFormDefault="qualified">
I have the following xsd
<xsd:complexType name="myID">
<xsd:choice>
<xsd:element name="testID" type="priv:testID"/>
<xsd:sequence>
<xsd:element name="newID" type="priv:newID"/>
<xsd:element name="testID" type="priv:testID" minOccurs="0"/>
</xsd:sequence>
</xsd:choice>
</xsd:complexType>
Everything is under priv namespace. The problem is that it looks like that myID is a union. It might be a testID or a sequence with newID and testID. When I compile it with wsdl2h from gsoap I am taking the message:
Note: <xs:choice> with embedded
<xs:sequence> or <xs:group>
prevents the use of a union
Is the above XSD correct?
In general the XML type myID can be declared as you described. The conflict exist probably in connection with your definition of the types priv:testID and priv:testID which definition you not included. For example the schema
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema targetNamespace="http://www.ok-soft-gmbh.com/xml/xsd/1.0/XMLSchema.xsd"
elementFormDefault="qualified"
xmlns:priv="http://www.ok-soft-gmbh.com/xml/xsd/1.0/XMLSchema.xsd"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
<xsd:simpleType name="testID">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:simpleType name="newID">
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
<xsd:complexType name="myID">
<xsd:choice>
<xsd:element name="testID" type="priv:testID"/>
<xsd:sequence>
<xsd:element name="newID" type="priv:newID"/>
<xsd:element name="testID" type="priv:testID" minOccurs="0"/>
</xsd:sequence>
</xsd:choice>
</xsd:complexType>
<xsd:element name="root" type="priv:myID"/>
</xsd:schema>
will be correct. So if an error exist, it is not in the part which you posted.