MATLAB Answers

0

Why does MATLAB not properly connect to my web service?

Most modern web services have "advanced" features that CREATECLASSFROMWSDL does not support. Some examples are:
1. Any kind of message binding beyond httpBasic binding.
2. SOAP message namespaces that differ from the targetNamespace of the WSDL document.
3. Interactive visualization and construction of a SOAP message

Products

1 Answer

Answer by MathWorks Support Team on 18 Oct 2013
 Accepted Answer

There are two options for using Web Services from MATLAB:
1. For simple web services, use createClassFromWsdl generated stubs.
2. For any reasonably complex schema defined Web Service (this includes most web services), the best option is to use a java based library like axis or cxf and their wsdl2java tool to create java stubs (client side interfaces for the Web Service).
As an example, for the following WSDL:
<xsd:complexType name="phone">
<xsd:all>
<xsd:element name="areaCode" type="xsd:int"/>
<xsd:element name="exchange" type="xsd:string"/>
<xsd:element name="number" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
WSDL2Java in Axis would generate:
public class Phone implements java.io.Serializable {
public Phone() {...}
public int getAreaCode() {...}
public void setAreaCode(int areaCode) {...}
public java.lang.String getExchange() {...}
public void setExchange(java.lang.String exchange) {...}
public java.lang.String getNumber() {...}
public void setNumber(java.lang.String number) {...}
public boolean equals(Object obj) {...}
public int hashCode() {...}
}
The above example has been taken from Axis user guide on ws.apache.org
The generated stubs can then be used in MATLAB as Java objects.

  0 Comments

Sign in to comment.