The following is an implementation of the specification outlined in the above picture.
#WebService
#SOAPBinding(style = Style.DOCUMENT)
public interface WithdrawService {
#WebMethod
public Response withdraw(
#WebParam(name="CORPCODE") String corpcode,
#WebParam(name="SERVCODE") String servcode,
#WebParam(name="AMOUNT") double amount,
#WebParam(name="CCYID") String ccyid,
#WebParam(name="ACCTNO") String acctno,
#WebParam(name="REFVAL1") String refvel1,
#WebParam(name="REFVAL2") String refval2,
#WebParam(name="TRANREF") String tranref,
#WebParam(name="DESC") String desc,
#WebParam(name="LICENSEID") String licenseid,
#WebParam(name="LICENSEKEY") String licensekey
);
}
The following WSDL is generated when a user accesses the ?wsdl link.
<!-- Published by JAX-WS RI (http://jax-ws.java.net). RI's version is JAX-WS RI 2.2.10 svn-revision#919b322c92f13ad085a933e8dd6dd35d4947364b.
-->
<!-- Generated by JAX-WS RI (http://jax-ws.java.net). RI's version is JAX-WS RI 2.2.10 svn-revision#919b322c92f13ad085a933e8dd6dd35d4947364b.
-->
<definitions targetNamespace="http://withdraw.kbz.nirvasoft.com/" name="WithdrawServiceImplService">
<types>
<xsd:schema>
<xsd:import namespace="http://withdraw.kbz.nirvasoft.com/" schemaLocation="http://localhost:8080/WithdrawService/withdraw?xsd=1"/>
</xsd:schema>
</types>
<message name="withdraw">
<part name="parameters" element="tns:withdraw"/>
</message>
<message name="withdrawResponse">
<part name="parameters" element="tns:withdrawResponse"/>
</message>
<portType name="WithdrawService">
<operation name="withdraw">
<input wsam:Action="http://withdraw.kbz.nirvasoft.com/WithdrawService/withdrawRequest" message="tns:withdraw"/>
<output wsam:Action="http://withdraw.kbz.nirvasoft.com/WithdrawService/withdrawResponse" message="tns:withdrawResponse"/>
</operation>
</portType>
<binding name="WithdrawServiceImplPortBinding" type="tns:WithdrawService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="withdraw">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="WithdrawServiceImplService">
<port name="WithdrawServiceImplPort" binding="tns:WithdrawServiceImplPortBinding">
<soap:address location="http://localhost:8080/WithdrawService/withdraw"/>
</port>
</service>
</definitions>
We are unhappy with two things.
We do not get any xsd documents for the types used.
We cannot say whether fields are required in the generated wsdl.
I would like to know how we could achieve them using our code.
You can get your XSD from
http://localhost:8080/WithdrawService/withdraw?xsd=1
Depending on the server you use you can ask JAX-WS to generate embedded XSD file. Alternatively you can ask JAX-WS to use you own WSDL.
Related
I have an Apache Camel project that uses CXF to send a SOAP payload . The project has been working flawlessly for over a year.
Recently, I was given a new WSDL to implement for this service ...nothing in the WSDL is suppose to change the payload
I am sending ( same classes and value objects, etc. )...the changes in the WSDL were suppose to be totally unrelated to
the payload I am sending.
I used wsdl2java, in my Maven POM, to generate the java sources from the WSDL ( as I did before ) and all compiles just fine & service deploys fine ( JBoss Fuse ).
When I send the payload however, the service complains that there is an "unexpected element" ...this is
strange since I did not change the payload and the Soap "Operation Name" I am calling is the same as with the old
WSDL ...the new WSDL has a different "serviceClass" name, however, the method I need to invoke is the same.
In the log output, I see the soapAction is not set but I am not sure this should matter ...once again, the
code ran fine with the previous WSDL which essentially has the same serviceClass elements.
As can be seen in the code fragment, I am attempting to use the createEDIInvoices operation from the WSDL ...that
operation expects a createEDIInvoices object ( which I am definately passing ) ...the log though shows
that the SOAP server was expecting createEDIInvoicesResponse :
Unexpected element {http://xmlns.inspyrus.com/ExternalInspyrusService}createEDIInvoices found.
Expected {http://xmlns.inspyrus.com/ExternalInspyrusService}createEDIInvoicesResponse.
Anyhow, opinions regarding the issue are welcome... I'm kinda wondering if I am not doing enough to specify the proper SOAP operation to execute
Here is the relevant code fragment from my Camel route ...note that the code blows on the to("cxf:...") call ...the bean is never called
from("direct:inspyrus-processing")
// specify SOAP operation as defined in WSDL
.setHeader(CxfConstants.OPERATION_NAME,
constant("createEDIInvoices"))
.setHeader(Inspyrus_Auth_Header, simple("{{inspyrus.auth.header}}"))
.to("cxf:http://fergusonsbx.invoice-automation.com/ExternalInspyrusService/ExternalInspyrusService" +
"?serviceClass=com.inspyrus.generated.invoiceprocessingservice.ExternalInspyrusService" +
"&wsdlURL=wsdl/Inspyrus_030119.wsdl" + "&cxfEndpointConfigurer=#cxfConfigurer" + "&loggingFeatureEnabled=true")
.to("bean:parse-inspyrusresponse")
.removeHeader(Inspyrus_Auth_Header)
.log(LoggingLevel.DEBUG, Constants.APP_ID + ": Inspyrus Processing Complete");
The CXFConfigurer code is below:
ManagedBean
#Named("cxfConfigurer")
public class CxfConfigurer implements CxfEndpointConfigurer {
private static final long CXF_CONNECTION_TIMEOUT = 180000;
private static final long CXF_RECEIVE_TIMEOUT = 360000;
#Override
public void configure(final AbstractWSDLBasedEndpointFactory factoryBean) {
}
#Override
public void configureClient(final Client client) {
final HTTPConduit http = (HTTPConduit) client.getConduit();
final HTTPClientPolicy policy = http.getClient();
policy.setAutoRedirect(true);
policy.setConnection(ConnectionType.KEEP_ALIVE);
policy.setConnectionTimeout(CXF_CONNECTION_TIMEOUT); // default is 30K
policy.setReceiveTimeout(CXF_RECEIVE_TIMEOUT); // default is 60K
// Don't be too strict with CN checking
final TLSClientParameters tlsCP = new TLSClientParameters();
tlsCP.setDisableCNCheck(true);
http.setTlsClientParameters(tlsCP);
}
#Override
public void configureServer(final Server server) {
}
The WSDL was generated from http://fergusonsbx.invoice-automation.com/ExternalInspyrusService/ExternalInspyrusService?wsdl ...it is below
<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Oracle JAX-WS 2.1.5. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Oracle JAX-WS 2.1.5. --><definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://xmlns.inspyrus.com/ExternalInspyrusService" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://xmlns.inspyrus.com/ExternalInspyrusService" name="ExternalInspyrusService">
<types>
<xsd:schema>
<xsd:import namespace="http://xmlns.inspyrus.com/ExternalInspyrusService" schemaLocation="ExternalInspyrusService_1.xsd"/>
</xsd:schema>
</types>
<message name="createEDIInvoices">
<part name="parameters" element="tns:createEDIInvoices"/>
</message>
<message name="createEDIInvoicesResponse">
<part name="parameters" element="tns:createEDIInvoicesResponse"/>
</message>
<portType name="ExternalInspyrusService">
<operation name="createEDIInvoices">
<input message="tns:createEDIInvoices"/>
<output message="tns:createEDIInvoicesResponse"/>
</operation>
</portType>
<binding name="ExternalInspyrusServicePortBinding" type="tns:ExternalInspyrusService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="createEDIInvoices">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="ExternalInspyrusService">
<port name="ExternalInspyrusServicePort" binding="tns:ExternalInspyrusServicePortBinding">
<soap:address location="http://fergusonsbx.invoice-automation.com:80/ExternalInspyrusService/ExternalInspyrusService"/>
</port>
</service>
</definitions>
Relevant Log Fragments
ID: 1
Address: http://fergusonsbx.invoice-automation.com/ExternalInspyrusService/ExternalInspyrusService
Encoding: UTF-8
Http-Method: POST
Content-Type: text/xml
Headers: {Accept=[*/*], accountId=[SANAN], Authorization=[n5zMltp5l2z2L+2tDC9l], breadcrumbId=[ID-fuse-localdomain-43307-1551479341458-13-1], Connection=[Keep-Alive], DESTINATION_SELL_LOCATION=[454], EDI_810_PONUMBER=[L454-11593], ISFREIGHT=[false], MAIN_BRANCH_NUMBER=[0061], PO_TYPE=[DIRECT], PROCESSED=[true], **SOAPAction=[""]**, SOURCE_PARTY_ID=[22449], UNPROCESSED_VENDORID=[SANAN*10770~1~1], UNPROCESSED_VENDORNUMBER=[10770], WAREHOUSE_NUMBER=[454]}
**Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:createEDIInvoices xmlns:ns2="http://xmlns.inspyrus.com/ExternalInspyrusService"><entityID>23 ....
16:47:18,662 INFO [org.apache.cxf.services.ExternalInspyrusService.ExternalInspyrusServicePort.ExternalInspyrusService] (default-workqueue-1) Inbound Message**
----------------------------
ID: 1
Response-Code: 200
Encoding: UTF-8
Content-Type: text/xml; charset=utf-8
Headers: {content-type=[text/xml; charset=utf-8], Date=[Sat, 02 Mar 2019 16:51:54 GMT], transfer-encoding=[chunked]}
Payload: <?xml version='1.0' encoding='UTF-8'?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header/><soap:Body><ns2:createEDIInvoices xmlns:ns2="http://xmlns.inspyrus.com/ExternalInspyrusService"><entityID>23</entityID><invoiceImport><header><captureProfile>EDI</captureProfile><currencyCode>USD</currencyCode><documentType>Invoice</documentType><flexAttribute10>Batch # 543421</flexAttribute10><flexAttribute12>543421</flexAttribute12><flexAttribute17>347.46</flexAttribute17><flexAttribute19>ST005.txt</flexAttribute19><flexAttribute21>120.46</flexAttribute21><flexAttribute22>16B286664984</flexAttribute22><flexAttribute23>EXLA ESTES EXPRESS LINES</flexAttribute23><flexAttribute24>W196-12965 </flexAttribute24><flexAttribute26>1% DISC 30 Days</flexAttribute26><flexAttribute27>2.22</flexAttribute27><flexAttribute28>February 17, 2019</flexAttribute28><flexAttribute29>February 16, 2019</flexAttribute29><flexAttribute3>125.00</flexAttribute3><flexAttribute30>1.00%</flexAttribute30><flexAttribute5>0454</flexAttribute5><flexAttribute6>DIRECT</flexAttribute6><flexAttribute8>SANAN*22449*383148735</flexAttribute8><invoiceDate>2019-01-17</invoiceDate><invoiceNumber>383148735</invoiceNumber><invoiceStatus>Open</invoiceStatus><invoiceTotalAmount>347.46</invoiceTotalAmount><leAddress1>PO BOX 9406</leAddress1><leCity>HAMPTON</leCity><leName>FERGUSON - HAMPTON</leName><lePostalCode>23670</lePostalCode><leState>VA</leState><orgID>0061</orgID><PONumber>L454-11593</PONumber><region>NA</region><scanDate>2019-01-17</scanDate><shipToAddress1>5206 W WATERS AVENUE</shipToAddress1><shipToCity>TAMPA</shipToCity><shipToName>FERGUSON 0196 TAMPA</shipToName><shipToPostalCode>33634</shipToPostalCode><shipToState>FL</shipToState><vendorAddress1>P.O Box 202893</vendorAddress1><vendorCity>DALLAS</vendorCity><vendorID>SANAN*22449~1~1</vendorID><vendorName>AS America, Inc.</vendorName><vendorNumber>22449</vendorNumber><vendorPostalCode>75320</vendorPostalCode><vendorSiteID>SANAN*22449~1~1</vendorSiteID><vendorState>TX</vendorState></header><lineItems><lineItem><lineNumber>1</lineNumber><lineType>ITEM</lineType><description># 5 FT AFR BATH LH OUT SOLAR WH</description><quantity>1</quantity><unitPrice>227.0000</unitPrice><lineTotalAmount>227.00</lineTotalAmount><UOM>EA</UOM><attribute4>0263212.020</attribute4><attribute5>A0263212020</attribute5></lineItem><lineItem><lineNumber>2</lineNumber><lineType>ITEM</lineType><description>Warranty</description><quantity>1</quantity><unitPrice>-4.5400</unitPrice><lineTotalAmount>-4.54</lineTotalAmount></lineItem></lineItems></invoiceImport></ns2:createEDIInvoices><soap:Fault><faultcode>F</faultcode><faultstring>Authorization Token not Found</faultstring></soap:Fault></soap:Body></soap:Envelope>
--------------------------------------
16:47:18,663 WARNING [org.apache.cxf.phase.PhaseInterceptorChain] (default-workqueue-1) Interceptor for {http://xmlns.inspyrus.com/ExternalInspyrusService}ExternalInspyrusService#{http://xmlns.inspyrus.com/ExternalInspyrusService}createEDIInvoices has thrown exception,
unwinding now: org.apache.cxf.interceptor.Fault:
Unexpected element {http://xmlns.inspyrus.com/ExternalInspyrusService}createEDIInvoices found.
Expected {http://xmlns.inspyrus.com/ExternalInspyrusService}createEDIInvoicesResponse.
I am trying to understand the structure of wsdl definitions, looking at the example found here.
I get the service, portType and operation parts, it's at the messages where I have a problem "reading" the specification.
So, just focusing at a single message (multiply), and ignoring the rest, I see a structure like:
<wsdl:definitions..>
<wsdl:types>
<xsd:schema>
<xsd:element name="multiply" type="tns:multiply"/>
<xsd:complexType name="multiply">
...
</xsd:complexType>
</xsd:schema>
</wsdl:types>
...
<wsdl:message name="multiply">
<wsdl:part element="tns:multiply" name="parameters"/>
</wsdl:message>
...
<wsdl:portType>
...
</wsdl:portType>
<wsdl:service>
...
</wsdl:service>
</wsdl:definitions>
Can anyone provide a sentence explaining what multiply is, beginning with: "multiply is a message that's ..." ??
Moreover, could somebody explain how many uses of the name "multiply" we have? I think there are multiple and we seem to avoid clashes through the use of XML namespaces and perhaps different "namespaces" for XML elements and types.
multiply is a message containing a single part, named parameters, consisting of the single element, tns:multiply. That element is of type tns:multiply.
I used XMLspy to fill this example out a bit:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tns="http://new.webservice.namespace" targetNamespace="http://new.webservice.namespace">
<wsdl:types>
<xs:schema targetNamespace="http://new.webservice.namespace" elementFormDefault="qualified">
<xs:complexType name="multiply">
<xs:sequence>
<xs:element name="x" type="xs:int"/>
<xs:element name="y" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:element name="multiply" type="tns:multiply"/>
</xs:schema>
</wsdl:types>
<wsdl:message name="multiply">
<wsdl:part name="parameters" element="tns:multiply"/>
</wsdl:message>
<wsdl:portType name="NewPortType">
<wsdl:operation name="NewOperation">
<wsdl:input message="tns:multiply"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="NewBinding" type="tns:NewPortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="NewOperation">
<soap:operation soapAction="urn:#NewOperation"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="NewService">
<wsdl:port name="NewPort" binding="tns:NewBinding">
<soap:address location="No target address"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
This leads to the following SOAP request:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<m:multiply xmlns:m="http://new.webservice.namespace">
<m:x>0</m:x>
<m:y>0</m:y>
</m:multiply>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:tns="http://schemas.ocbc.com/soa/WSDL/service/CBS-CustAddress-I" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="http://schemas.ocbc.com/soa/emf/common/envelope/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://schemas.ocbc.com/soa/WSDL/service/CBS-CustAddress-I">
<import namespace="http://schemas.ocbc.com/soa/emf/common/envelope/" location="../Schemas/XML/CBS-CustAddress-I-ServiceEnvelope.xsd"/>
<message name="InputMessage">
<part name="InputMessage" element="ns:ServiceEnvelope"/>
</message>
<message name="OutMessage">
<part name="OutMessage" element="ns:ServiceEnvelope"/>
</message>
<message name="FaultMessage">
<part name="FaultMessage" element="ns:ServiceEnvelope"/>
</message>
<portType name="PortType">
<operation name="Operation">
<input message="tns:InputMessage"/>
<output message="tns:OutMessage"/>
<fault name="fault1" message="tns:FaultMessage"/>
</operation>
</portType>
</definitions>
I'm trying to generate client for above WSDL in Eclipse but I got the following error.
Java 1.7 eclipse kepler to generate the client code for the wsdl
IWAB0399E Error in generating Java from WSDL: java.io.IOException: Error: attribute is of type {http://schemas.ocbc.com/soa/emf/common/envelope/}encodingStyle, which is not a simple type
java.io.IOException: Error: attribute is of type {http://schemas.ocbc.com/soa/emf/common/envelope/}encodingStyle, which is not a simple type
at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.java:1043)
at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.java:1119)
at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.java:1119)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populateTypes(SymbolTable.java:909)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:705)
at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.java:1092)
at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.java:1119)
at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.java:1119)
at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.java:1119)
at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.java:1119)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populateTypes(SymbolTable.java:909)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:705)
at org.apache.axis.wsdl.symbolTable.SymbolTable.add(SymbolTable.java:543)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:518)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:495)
at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:361)
at java.lang.Thread.run(Unknown Source)
CBS-CustAddress-I-ServiceEnvelope.XSD :
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:emf-envelope="http://schemas.ocbc.com/soa/emf/common/envelope/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:emf-header="http://schemas.ocbc.com/soa/emf/common/header"
xmlns:emf-body="http://schemas.ocbc.com/soa/emf/common/body"
xmlns:CBS-CustAddress-I="http://schemas.ocbc.com/soa/emf/service/CBS-CustAddress-I"
targetNamespace="http://schemas.ocbc.com/soa/emf/common/envelope/"
elementFormDefault="unqualified"
attributeFormDefault="unqualified">
<import namespace="http://schemas.ocbc.com/soa/emf/common/header" schemaLocation="../../../../Schemas/XML/CommonHeader.xsd"/>
<import namespace="http://schemas.ocbc.com/soa/emf/common/body" schemaLocation="../../../../Schemas/XML/CommonBody.xsd"/>
<import namespace="http://schemas.ocbc.com/soa/emf/service/CBS-CustAddress-I" schemaLocation="CBS-CustAddress-I.xsd"/>
<attributeGroup name="encodingStyle">
<attribute ref="emf-envelope:encodingStyle"/>
</attributeGroup>
<!-- Envelope, header and body -->
<element name="ServiceEnvelope" type="emf-envelope:ServiceEnvelope"/>
<complexType name="ServiceEnvelope">
<sequence>
<element ref="emf-envelope:ServiceHeader" minOccurs="0"/>
<element ref="emf-envelope:ServiceBody"/>
<any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<anyAttribute namespace="##other" processContents="lax"/>
</complexType>
<element name="ServiceHeader" type="emf-envelope:ServiceHeader"/>
<complexType name="ServiceHeader">
<sequence>
<element ref="emf-header:CommonDetail"/>
<choice>
<element ref="emf-header:ClientDetail"/>
<element ref="emf-header:ProviderDetail"/>
</choice>
<element ref="emf-header:SecurityDetail" minOccurs="0"/>
</sequence>
</complexType>
<element name="ServiceBody" type="emf-envelope:ServiceBody"/>
<complexType name="ServiceBody">
<choice>
<element ref="CBS-CustAddress-I:RqDetail"/>
<element ref="CBS-CustAddress-I:RsDetail"/>
<element ref="emf-body:Error"/>
</choice>
<anyAttribute namespace="##any" processContents="lax"/>
</complexType>
<element name="CommonDetail" type="emf-envelope:CommonDetail"/>
<complexType name="CommonDetail">
<sequence>
<any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<anyAttribute namespace="##any" processContents="lax"/>
</complexType>
<!-- Global Attributes. The following attributes are intended to be usable via qualified attribute names on any complex type referencing them. -->
<attribute name="mustUnderstand">
<simpleType>
<restriction base="xs:boolean">
<pattern value="0|1"/>
</restriction>
</simpleType>
</attribute>
<attribute name="actor" type="xs:anyURI"/>
<simpleType name="encodingStyle">
<annotation>
<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</documentation>
</annotation>
<list itemType="xs:anyURI"/>
</simpleType>
<attribute name="encodingStyle" type="emf-envelope:encodingStyle"/>
#vineeth : XSD is attached as requested
I have also included my CBS-CustAddress-I.XSD incase if you want to refer that too.
<?xml version = "1.0" encoding = "UTF-8"?>
<xsd:schema xmlns = "http://schemas.ocbc.com/soa/emf/service/CBS-CustAddress-I"
targetNamespace = "http://schemas.ocbc.com/soa/emf/service/CBS-CustAddress-I"
xmlns:emf-aggregates = "http://schemas.ocbc.com/soa/emf/common/aggregates"
xmlns:xsd = "http://www.w3.org/2001/XMLSchema"
xmlns:emf-elements = "http://schemas.ocbc.com/soa/emf/common/elements"
version = "1.0.01"
elementFormDefault = "qualified">
<xsd:import namespace = "http://schemas.ocbc.com/soa/emf/common/aggregates" schemaLocation = "../../../../Schemas/XML/CommonAggregates.xsd"/>
<xsd:import namespace = "http://schemas.ocbc.com/soa/emf/common/elements" schemaLocation = "../../../../Schemas/XML/CommonElements.xsd"/>
<xsd:element name = "RqDetail">
<xsd:complexType>
<xsd:sequence>
<xsd:sequence>
<xsd:element ref = "emf-elements:PostalCode"/>
</xsd:sequence>
<xsd:element ref = "CountryCode" minOccurs = "0"/>
<xsd:element ref = "emf-aggregates:SelectionDetail" minOccurs = "0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name = "RsDetail">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref = "emf-aggregates:AddressDetail"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name = "CountryCode" type = "xsd:string"/>
</xsd:schema>
firstly i have concerns over the xsd imports:
<import namespace="http://schemas.ocbc.com/soa/emf/common/header"
schemaLocation="../../../../Schemas/XML/CommonHeader.xsd"/>
<import namespace="http://schemas.ocbc.com/soa/emf/common/body"
schemaLocation="../../../../Schemas/XML/CommonBody.xsd"/>
<import namespace="http://schemas.ocbc.com/soa/emf/service/CBS-CustAddress-I"
schemaLocation="CBS-CustAddress-I.xsd"/>
The Schema locations need to be checked if they refer to proper location or not..to check this it will be ideal to check it via a IDE like JDeveloper. It will give u warnings in case it finds issues. Try to place these schema in the same location as the all the WSDL and XSDs and also similarly change the path.
The error that you see might be because of the below code:
<attributeGroup name="encodingStyle">
<attribute ref="emf-envelope:encodingStyle"/>
</attributeGroup>
It refers to a location to find the definition but fails.
My suggestions are mainly 2:
1) Try to simplify the XSD if possible.
2) Try to use a different IDE than eclipse. I prefer Oracle Jdeveloper as it has simple wizard.
Hope this helps
when generating a proxy class from a wsdl which I got from a customer, I get the following warning from svcutil:
Warning: Fault named "ContractException" in operation "create" cannot be imported.
Unsupported WSDL, the fault message part must reference an element. This fault message
does not reference an element. If you have edit access to the WSDL document, you can fix
the problem by referencing a schema element using the 'element' attribute.
So, here are the parts from the wsdl in which the ContractException is mentioned
<schema targetNamespace="http://exceptions.webservice"
xmlns="http://www.w3.org/2001/XMLSchema" xmlns:impl="http://webservice"
xmlns:intf="http://webservice"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="ContractException">
<sequence>
<element name="message" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<element name="ContractException" nillable="true" type="tns3:ContractException"/>
</schema>
<wsdl:message name="ContractException">
<wsdl:part name="fault" type="tns3:ContractException"/>
</wsdl:message>
<wsdl:portType name="Contract">
<wsdl:operation name="create" parameterOrder="pApiKey pContractData">
<wsdl:input message="impl:createRequest" name="createRequest"/>
<wsdl:output message="impl:createResponse" name="createResponse"/>
<wsdl:fault message="impl:ContractException" name="ContractException"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:fault name="ContractException">
<wsdlsoap:fault encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
name="ContractException" use="encoded"/>
</wsdl:fault>
I cannot find any problems in this wsdl, but hopefully anyone can give me a hint what I have to change so my proxy gets generated successfully.
The wsdl was donwloaded from the webserver, so I can edit my local copy (which I use for generating the proxy class).
Based on the error message displayed, the fault needs to be wrapped inside an element, i.e. -
instead of:
<wsdl:message name="ContractException">
<wsdl:part name="fault" type="tns3:ContractException"/>
</wsdl:message>
you need to do this:
<wsdl:message name="ContractException">
<wsdl:part name="fault" element="tns3:ContractException"/>
</wsdl:message>
Why WSDL introduces wsdl:message? And message parts?
What the advantage they could bring over the direct using of the XSD in the operations parameters (input, output, fault)?
How they (wsdl messages with wsdl message parts) can be more abstract then XSD?
Why it is not organized for example that way:
<operation name="GetEndorsingBoarder">
<input type="xsd:string"/>
<output type="xsd:string, xsd:int, xsd:boolean"/>
<fault "type="xsd:string""/>
</operation>
I got it:
Messages not just specify operation's parameters.
Messages and theirs parts are referred in the bindings. It should be possible to bind different parts differently:
<message name="m1">
<part name="body" element="tns:GetCompanyInfo"/>
</message>
<message name="m2">
<part name="body" element="tns:GetCompanyInfoResult"/>
<part name="docs" type="xsd:string"/>
<part name="logo" type="tns:ArrayOfBinary"/>
</message>
<portType name="pt1">
<operation name="GetCompanyInfo">
<input message="m1"/>
<output message="m2"/>
</operation>
</portType>
<binding name="b1" type="tns:pt1">
<operation name="GetCompanyInfo">
<soap:operation soapAction="http://example.com/GetCompanyInfo"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<mime:multipartRelated>
<mime:part>
<soap:body parts="body" use="literal"/>
</mime:part>
<mime:part>
<mime:content part="docs" type="text/html"/>
</mime:part>
<mime:part>
<mime:content part="logo" type="image/gif"/>
<mime:content part="logo" type="image/jpeg"/>
</mime:part>
</mime:multipartRelated>
</output>
</operation>
</binding>
I have missed this since "non SOAP 'literal'" bindings are so uncommon.
A XSD describes the DATA aspects, for example data aspects of webservice call whereas the WSDL describes the purpose of the web services (method calls). You cannot typically figure out the method calls from your data alone.
Check out Cheeso and Marc answers on Generating a WSDL from an XSD file
EDIT: source
The message describes the data being exchanged between the web services' provider and consumer and each web service has two messages:
1) input: parameters of the web service
2) output: return data from the web service
Each message has zero or more part parameters (one for each parameter of the web service's function) Each part parameter associates with a concrete type defined in the types container element.
<message name="SayHelloRequest">
<part name="firstName" type="xsd:string"/>
</message>
<message name="SayHelloResponse">
<part name="greeting" type="xsd:string"/>
</message>
Here, two message elements are defined. The first represents a request message SayHelloRequest, and the second represents a response message SayHelloResponse.
Each of these messages contains a single part element. For the request, the part specifies the function parameters; in this case, we specify a single firstName parameter. For the response, the part specifies the function return values; in this case, we specify a single greeting return value.