手动从WSDL创建SOAP请求

时间:2019-10-03 21:20:24

标签: web-services soap wsdl

我试图通过仅阅读WSDL来弄清楚如何编写SOAP请求。

一切都指向可以使用的库或客户端,这是可以理解的,但是如果我想使用cURL或Postman,我确实想知道如何阅读WSDL并自己编写响应。 (我知道写出XML非常耗时,使用SoapUI之类的东西更容易,但是我想弄清楚通常如何构建这些SOAP请求。)

我以NOAA为例。 http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl

<?xml version="1.0"?>
<!--   **********************************************************************   

       ndfdXML.wsdl   

       John L. Schattel          MDL                4 July 2007  
       Aniesha L. Alford
       Red Hat Linux                                Apache Server  

       SOURCE CODE CONTROL INFORMATION   

       Name:  
         %PM%  
         %PID%  

       Status:  
         %PS%   

       History:  
         %PL%                                                             

       Change Document History:                                            
         %PIRC%                                                           

      *************************************************************************   -->
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
             xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
             xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
             xmlns:si="http://soapinterop.org/xsd" 
             xmlns:tns="https://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl" 
             xmlns:typens="https://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd" 
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
             xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
             xmlns="http://schemas.xmlsoap.org/wsdl/" 
             targetNamespace="https://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl">
    <types>
        <xsd:schema targetNamespace="https://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd">
            <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
            <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
            <xsd:simpleType name="sectorType">
                <xsd:restriction base='xsd:string'>
                    <xsd:enumeration value='conus'/>
                    <xsd:enumeration value='nhemi'/>
                    <xsd:enumeration value='alaska'/>
                    <xsd:enumeration value='guam'/>
                    <xsd:enumeration value='hawaii'/>
                    <xsd:enumeration value='puertori'/>
                    <xsd:enumeration value='npacocn'/>
                </xsd:restriction>
            </xsd:simpleType>
            <xsd:simpleType name="unitType">
                <xsd:restriction base='xsd:string'>
                    <xsd:enumeration value='e'/>
                    <xsd:enumeration value='m'/>
                </xsd:restriction>
            </xsd:simpleType>
            <xsd:simpleType name="formatType">
                <xsd:restriction base='xsd:string'>
                    <xsd:enumeration value='24 hourly'/>
                    <xsd:enumeration value='12 hourly'/>
                </xsd:restriction>
            </xsd:simpleType>
            <xsd:simpleType name="productType">
                <xsd:restriction base='xsd:string'>
                    <xsd:enumeration value='time-series'/>
                    <xsd:enumeration value='glance'/>
                </xsd:restriction>
            </xsd:simpleType>
            <xsd:simpleType name="latLonPairType">
                <xsd:restriction base='xsd:string'>
                    <xsd:pattern value="[\-]?\d{1,2}\.\d+,[\-]?\d{1,3}\.\d+" />
                </xsd:restriction>
            </xsd:simpleType>
            <xsd:simpleType name="listLatLonType">
                <xsd:restriction base='xsd:string'>
                    <xsd:pattern value="[\-]?\d{1,2}\.\d+,[\-]?\d{1,3}\.\d+( [\-]?\d{1,2}\.\d+,[\-]?\d{1,3}\.\d+)*" />
                </xsd:restriction>
            </xsd:simpleType>
            <xsd:simpleType name="zipCodeType">
                <xsd:restriction base='xsd:string'>
                    <xsd:pattern value="\d{5}(\-\d{4})?" />
                </xsd:restriction>
            </xsd:simpleType>
            <xsd:simpleType name="zipCodeListType">
                <xsd:restriction base='xsd:string'>
                    <xsd:pattern value="\d{5}(\-\d{4})?( \d{5}(\-\d{4})?)*" />
                </xsd:restriction>
            </xsd:simpleType>
            <xsd:simpleType name="featureTypeType">
                <xsd:restriction base='xsd:string'>
                    <xsd:enumeration value='Forecast_Gml2Point'/>
                    <xsd:enumeration value='Forecast_Gml2AllWx'/>
                    <xsd:enumeration value='Forecast_GmlsfPoint'/>
                    <xsd:enumeration value='Forecast_GmlObs'/>
                    <xsd:enumeration value='NdfdMultiPointCoverage'/>
                    <xsd:enumeration value='Ndfd_KmlPoint'/>
                </xsd:restriction>
            </xsd:simpleType>
            <xsd:simpleType name="compTypeType">
                <xsd:restriction base='xsd:string'>
                    <xsd:enumeration value='IsEqual'/>
                    <xsd:enumeration value='Between'/>
                    <xsd:enumeration value='GreaterThan'/>
                    <xsd:enumeration value='GreaterThanEqualTo'/>
                    <xsd:enumeration value='LessThan'/>
                    <xsd:enumeration value='LessThanEqualTo'/>
                </xsd:restriction>
            </xsd:simpleType>
            <xsd:simpleType name="listCityNamesType">
                <xsd:restriction base='xsd:string'>
                    <xsd:pattern value="[a-zA-Z'\-]*( ?[a-zA-Z'\-]*)*,[A-Z][A-Z](\|[a-zA-Z'\-]*( ?[a-zA-Z'\-]*)*,[A-Z][A-Z])*" />
                </xsd:restriction>
            </xsd:simpleType>
            <xsd:simpleType name="displayLevelType">
                <xsd:restriction base='xsd:integer'>
                    <xsd:enumeration value='1'/>
                    <xsd:enumeration value='2'/>
                    <xsd:enumeration value='3'/>
                    <xsd:enumeration value='4'/>
                    <xsd:enumeration value='12'/>
                    <xsd:enumeration value='34'/>
                    <xsd:enumeration value='1234'/>
                </xsd:restriction>
            </xsd:simpleType>
            <xsd:complexType name="weatherParametersType">
                <xsd:all>
                    <xsd:element name="maxt"         type="xsd:boolean"/>
                    <xsd:element name="mint"         type="xsd:boolean"/>
                    <xsd:element name="temp"         type="xsd:boolean"/>
                    <xsd:element name="dew"          type="xsd:boolean"/>
                    <xsd:element name="pop12"        type="xsd:boolean"/>
                    <xsd:element name="qpf"      

    type="xsd:boolean"/>
.
.
.
    </definitions>

这很长,所以我把它缩短了。

主要我想知道:

  • 如何获取每个操作的端点
  • 我应该把什么放入体内?
  • 在正文消息中使用什么QName和名称空间?

每个资源都在说明只使用SoapUI或使用库生成,而错过了学习如何阅读WSDL的机会。我正在寻找后者。请。

0 个答案:

没有答案
相关问题