douzhiling3166 2014-02-18 10:30 采纳率: 100%
浏览 90

PHP中的SOAP请求出错

I'm trying to send complex SOAP request in PHP. I think that problem might be in WSDL file which has defined namespace and schemaLocation for GSBSchema.xsd but nowhere is defined for KorisnickiPretinacSchema.xsd. This is the part of my PHP code:

    $par_data=array("KorisnickiPretinacPoruka" => 
        array("Zaglavlje"=>
            array("IdPosiljatelja"=>"196","IdPoruke"=>$UUID,"DatumVrijemeSlanja"=>$date_time,"RazinaSigurnosti"=>2),
                "Poruka" =>array("PinPrimatelja"=>$OIB,"OznakaDrzave"=>$County_code,"Predmet"=>$title,"Sadrzaj"=>base64_encode($rows_lines))));

    $par_envelope=array( "GsbEnvelope" =>  
        array( "MessageHeader" => 
            array("SenderId" => "24",
                "ServiceId" => "123",
                "MessageId" => $UUID,
                "SenderTimeStamp" => $date_time),
                "Content" => array("MimeType" =>"application/xml","Data" =>array("any"=>$par_data,"encoding"=>"BASE64"))));



    $par_WSDL=array("trace"=>TRUE,
        "exceptions"=>TRUE,
        'location'=>$SERVICE_TEST,
        "local_cert" =>$SOAP_cert,
        'uri'=>$NAMESPACE_URI,
        "passphrase"=>$cert_password,
        "connection_timeout" => 60);

    $client = new BeSimple\SoapClient\SoapClient("GSBService.wsdl",$par_WSDL);



    print_r( $client->sendMessage($par_envelope));

    echo "<p>Request :".htmlspecialchars($client->__getLastRequest()) ."</p>";
    echo "<p>Response:".htmlspecialchars($client->__getLastResponse())."</p>";
    echo "<p>Debug:".soapDebug($client)."</p>";

This is WSDL file i have included in my PHP script:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="GSBService"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.apis-it.hr/umu/2013/services/GSBService"
    xmlns:umu="http://www.apis-it.hr/umu/2013/services/GSBService"
    xmlns:gsb="http://apis-it.hr/umu/2013/types/gsb">

  <wsdl:types>
    <xsd:schema targetNamespace="http://www.apis-it.hr/umu/2013/services/GSBService">
        <xsd:import namespace="http://apis-it.hr/umu/2013/types/gsb" schemaLocation="../schema/GSBSchema.xsd"/>
    </xsd:schema>
  </wsdl:types>


  <wsdl:message name="SendMessageRequest">
    <wsdl:part element="gsb:SendMessageRequest" name="request"/>
  </wsdl:message>
  <wsdl:message name="SendMessageResponse">
    <wsdl:part element="gsb:SendMessageResponse" name="response"/>
  </wsdl:message>

  <wsdl:message name="EchoRequest">
    <wsdl:part element="gsb:EchoRequest" name="request" />
  </wsdl:message>
  <wsdl:message name="EchoResponse">
    <wsdl:part element="gsb:EchoResponse" name="response" />
  </wsdl:message>

  <wsdl:portType name="GSBServicePortType">
    <wsdl:operation name="sendMessage">
      <wsdl:input message="umu:SendMessageRequest"/>
      <wsdl:output message="umu:SendMessageResponse"/>
    </wsdl:operation>
    <wsdl:operation name="echo">
        <wsdl:input message="umu:EchoRequest"/>
        <wsdl:output message="umu:EchoResponse"/>
    </wsdl:operation>
  </wsdl:portType>

  <wsdl:binding name="GSBService" type="umu:GSBServicePortType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="sendMessage">
      <soap:operation soapAction="http://www.apis-it.hr/umu/2013/services/GSBService/sendMessage"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="echo">
        <soap:operation soapAction="http://www.apis-it.hr/umu/2013/services/GSBService/echo"/>
        <wsdl:input>
            <soap:body use="literal"/>
        </wsdl:input>
        <wsdl:output>
            <soap:body use="literal"/>
        </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>

  <wsdl:service name="GSBService">
    <wsdl:port binding="umu:GSBService" name="GSBServicePortType">
      <soap:address location="http://www.apis-it.hr:8849/GsbService"/>
    </wsdl:port>
  </wsdl:service>

</wsdl:definitions>

This is XSD (GSBSchema.xsd) schema:

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://apis-it.hr/umu/2013/types/gsb"
    xmlns:tns="http://apis-it.hr/umu/2013/types/gsb" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
    elementFormDefault="qualified">

    <import namespace="http://www.w3.org/2000/09/xmldsig#"
        schemaLocation="../schema/xmldsig-core-schema.xsd" />

    <element name="SendMessageRequest">
        <annotation>
            <documentation>
                Send message service request
            </documentation>
        </annotation>
        <complexType>
            <sequence>
                <element name="GsbEnvelope" type="tns:GsbEnvelopeType" minOccurs="1" maxOccurs="1"/>
            </sequence>
        </complexType>
    </element>

    <element name="SendMessageResponse">
        <annotation>
            <documentation>
                Send message service response
            </documentation>
        </annotation>
        <complexType>
            <sequence>
                <element name="MessageHeader" type="tns:MessageHeaderType" minOccurs="0" maxOccurs="1" />
                <element name="Content" type="tns:ContentType" minOccurs="0" maxOccurs="1" />
                <element name="Errors" type="tns:ErrorsType" minOccurs="0" maxOccurs="1" />
                <element ref="ds:Signature" minOccurs="0" maxOccurs="1" />
            </sequence>
        </complexType>
    </element>

    <element name="EchoRequest" type="string" nillable="false">
        <annotation>
            <documentation>Poruka echo metodi.</documentation>
        </annotation>
    </element>

    <element name="EchoResponse" type="string" nillable="false">
        <annotation>
            <documentation>Odgovor echo metode u obliku: "Request:
                'echoRequest'. Response: 'yyyy-MM-dd'T'HH:mm:ss.SSSZ'.
            </documentation>
        </annotation>
    </element>


    <complexType name="GsbEnvelopeType">
        <annotation>
            <documentation>
                Envelope used in gsb communication
        </documentation>
        </annotation>
        <sequence>
            <element name="MessageHeader" type="tns:MessageHeaderType"
                minOccurs="1" maxOccurs="1" />
            <element ref="ds:Signature" minOccurs="0" maxOccurs="1" />
            <element name="Content" type="tns:ContentType" minOccurs="1"
                maxOccurs="1" />
        </sequence>
    </complexType>

    <complexType name="MessageHeaderType">
        <sequence>
            <element name="SenderId" type="tns:SenderIdType" minOccurs="1" maxOccurs="1" />
            <element name="ServiceId" type="tns:ServiceIdType" minOccurs="1" maxOccurs="1" />
            <element name="AditionalServiceId" type="tns:ServiceIdType" minOccurs="0" maxOccurs="1" />
            <element name="MessageId" type="tns:UUIDType" minOccurs="1" maxOccurs="1" />
            <element name="GsbId" type="tns:UUIDType" minOccurs="0" maxOccurs="1" />
            <element name="SenderTimeStamp" type="dateTime" minOccurs="1" maxOccurs="1" />
            <element name="ReceivingTimeStamp" type="dateTime" minOccurs="0" maxOccurs="1" />
            <element name="ForwardingTimeStamp" type="dateTime" minOccurs="0" maxOccurs="1" />
            <element name="ReceiverTimeStamp" type="dateTime" minOccurs="0" maxOccurs="1" />
            <element name="ReplyReceivingTimeStamp" type="dateTime" minOccurs="0" maxOccurs="1" />
            <element name="ReplyForwardingTimeStamp" type="dateTime" minOccurs="0" maxOccurs="1" />
            <element name="ExchangeStatus" type="tns:StatusType" minOccurs="0" maxOccurs="1" />
        </sequence>
    </complexType>

    <complexType name="ContentType">
        <sequence>
            <element name="MimeType" type="string" minOccurs="1"
                maxOccurs="1" />
            <element name="Description" type="string" minOccurs="0"
                maxOccurs="1">
                <annotation>
                    <documentation>
                        Optional document description. Max lenght 255
                        characters.
            </documentation>
                </annotation>
            </element>
            <element name="Data" minOccurs="1" maxOccurs="1">
                <complexType mixed="true">
                    <sequence minOccurs="0" maxOccurs="unbounded">
                        <any namespace="##any" processContents="lax" />
                    </sequence>
                    <attribute name="encoding" use="required">
                        <simpleType>
                            <restriction base="string">
                                <enumeration value="EMBEDDED" />
                                <enumeration value="BASE64" />
                            </restriction>
                        </simpleType>
                    </attribute>
                    <anyAttribute namespace="##any" />
                </complexType>
            </element>
        </sequence>
    </complexType>

    <complexType name="ErrorsType">
        <sequence>
            <element name="Error" type="tns:ErrorType" minOccurs="1"
                maxOccurs="unbounded" />
        </sequence>
    </complexType>

    <complexType name="ErrorType">
        <sequence>
            <element name="ErrorCode" type="tns:ErrorCodeType" minOccurs="1"
                maxOccurs="1" />
            <element name="ErrorMessage" type="tns:ErrorMessageType"
                minOccurs="1" maxOccurs="1" />
        </sequence>
    </complexType>

    <simpleType name="ErrorCodeType">
        <restriction base="string">
            <pattern value="s[0-9]{3}" />
        </restriction>
    </simpleType>

    <simpleType name="ErrorMessageType">
        <restriction base="string">
            <maxLength value="500" />
        </restriction>
    </simpleType>


    <simpleType name="SenderIdType">
        <restriction base="string">
            <minLength value="1" />
            <maxLength value="9" />
            <pattern value="[0-9]+" />
        </restriction>
    </simpleType>

    <simpleType name="StatusType">
        <restriction base="string">
            <minLength value="1" />
            <maxLength value="1" />
        </restriction>
    </simpleType>

    <simpleType name="ServiceIdType">
        <restriction base="string">
            <minLength value="1" />
            <maxLength value="9" />
            <pattern value="[0-9]+" />
        </restriction>
    </simpleType>

    <simpleType name="UUIDType">
        <restriction base="string">
            <pattern
                value="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}" />
        </restriction>
    </simpleType>

</schema>

This is XSD (KorisnickiPretinacSchema.xsd) schema:

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://apis-it.hr/umu/2013/types/kp"
        xmlns:tns="http://apis-it.hr/umu/2013/types/kp"
        elementFormDefault="qualified">

    <element name="KorisnickiPretinacPoruka" type="tns:KorisnickiPretinacPorukaType"/>
    <element name="Odgovor" type="tns:OdgovorType"/>

    <complexType name="KorisnickiPretinacPorukaType">
        <sequence>
            <element name="Zaglavlje" type="tns:ZaglavljeType" minOccurs="1" maxOccurs="1"/>
            <element name="Poruka" type="tns:PorukaType" minOccurs="1" maxOccurs="1"/>
            <element name="Privici" type="tns:PriviciType" minOccurs="0" maxOccurs="1"/>
        </sequence>
    </complexType>

    <complexType name="OdgovorType">
        <sequence>
            <element name="IdPorukePosiljatelja" type="tns:UUIDType" minOccurs="0" maxOccurs="1"/>
            <element name="DatumVrijemeObrade" type="dateTime" minOccurs="0" maxOccurs="1"/>
            <element name="Greske" type="tns:GreskeType" minOccurs="0" maxOccurs="1"/>
        </sequence>
    </complexType>


    <complexType name="ZaglavljeType">
        <sequence>
            <element name="IdPosiljatelja" type="tns:PosiljateljIdType" minOccurs="1" maxOccurs="1" />
            <element name="IdPoruke" type="tns:UUIDType" minOccurs="1" maxOccurs="1"/>
            <element name="DatumVrijemeSlanja" type="dateTime" minOccurs="1" maxOccurs="1"/>
            <element name="RazinaSigurnosti" minOccurs="1" maxOccurs="1">
                <simpleType>
                    <restriction base="string">
                        <minLength value="1"/>
                        <maxLength value="1"/>
                    </restriction>
                </simpleType>
            </element>
        </sequence>
    </complexType>

    <complexType name="PorukaType">
        <sequence>
            <element name="PinPrimatelja" type="tns:PinType" minOccurs="1" maxOccurs="1"/>
            <element name="OznakaDrzave" minOccurs="1" maxOccurs="1">
                <annotation>
                    <documentation>
                        Oznaka države prema šifarniku. Za hrvatske građane oznaka HR
                    </documentation>
                </annotation>
                <simpleType>
                    <restriction base="string">
                        <minLength value="2"/>
                        <maxLength value="2"/>
                    </restriction>
                </simpleType>
            </element>
            <element name="Predmet" minOccurs="1" maxOccurs="1">
                <simpleType>
                    <restriction base="string">
                        <minLength value="1"/>
                        <maxLength value="200"/>
                    </restriction>
                </simpleType>
            </element>
            <element name="Sadrzaj" minOccurs="1" maxOccurs="1">
                <simpleType>
                    <restriction base="string">
                        <minLength value="1"/>
                        <maxLength value="2000"/>
                    </restriction>
                </simpleType>
            </element>
        </sequence>
    </complexType>

    <complexType name="PriviciType">
        <sequence>
            <element name="Privitak" type="tns:PrivitakType" minOccurs="1" maxOccurs="unbounded"/>
        </sequence>
    </complexType>

    <complexType name="PrivitakType">
        <sequence>
            <element name="Naziv" type="string" minOccurs="1" maxOccurs="1"/>
            <element name="MimeType" type="string" minOccurs="1" maxOccurs="1" />
            <element name="Opis" type="string" minOccurs="0" maxOccurs="1">
                <annotation>
                    <documentation>
                        Optional document description. Max lenght 255
                        characters.
            </documentation>
                </annotation>
            </element>
            <element name="Data" minOccurs="1" maxOccurs="1">
                <complexType mixed="true">
                    <sequence minOccurs="0" maxOccurs="unbounded">
                        <any namespace="##any" processContents="lax" />
                    </sequence>
                    <attribute name="encoding" use="required">
                        <simpleType>
                            <restriction base="string">
                                <enumeration value="EMBEDDED" />
                                <enumeration value="BASE64" />
                            </restriction>
                        </simpleType>
                    </attribute>
                    <anyAttribute namespace="##any" />
                </complexType>
            </element>
        </sequence>
    </complexType>

    <complexType name="GreskeType">
        <sequence>
            <element name="Greska" type="tns:GreskaType" minOccurs="1"  maxOccurs="unbounded" />
        </sequence>
    </complexType>

    <complexType name="GreskaType">
        <sequence>
            <element name="SifraGreske" type="tns:SifraGreskeType" minOccurs="1" maxOccurs="1" />
            <element name="OpisGreske" type="tns:OpisGreskeType" minOccurs="1" maxOccurs="1" />
        </sequence>
    </complexType>

    <simpleType name="SifraGreskeType">
        <restriction base="string">
            <pattern value="s[0-9]{3}" />
        </restriction>
    </simpleType>

    <simpleType name="OpisGreskeType">
        <restriction base="string">
            <maxLength value="500" />
        </restriction>
    </simpleType>


    <simpleType name="PosiljateljIdType">
        <restriction base="string">
            <minLength value="1" />
            <maxLength value="9" />
            <pattern value="[0-9]+" />
        </restriction>
    </simpleType>

    <simpleType name="PinType">
        <restriction base="string">
            <minLength value="1" />
            <maxLength value="20" />
            <pattern value="[0-9]+" />
        </restriction>
    </simpleType>

    <simpleType name="UUIDType">
        <restriction base="string">
            <pattern
                value="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}" />
        </restriction>
    </simpleType>



</schema>

This is error message I'm getting:

[Data] => stdClass Object ( 
[any] => 2014-02-18T11:12:12.394+01:00K002cvc-complex-type.2.3: Element
'KorisnickiPretinacPoruka' cannot have character 
[children], because the type's content type is 
element-only.K002cvc-complex-type.2.4.b: The content of element 
'KorisnickiPretinacPoruka' is not complete. One of 
'{"http://apis-it.hr/umu/2013/types/kp":Zaglavlje}' is expected. 
[encoding] => EMBEDDED )

I have tried any kind of combinations o $par_data to generate valid request. I have tried adding elements like "targetNamespace"=>"http://apis-it.hr/umu/2013/types/kp" or deliting elements array("KorisnickiPretinacPoruka" =>"" ); with same error.

EDIT: Maybe this can help this is output I'm getting:

  Request :<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://apis-it.hr/umu/2013/types/gsb"><SOAP-ENV:Body><ns1:SendMessageRequest><ns1:GsbEnvelope><ns1:MessageHeader><ns1:SenderId>24</ns1:SenderId><ns1:ServiceId>123</ns1:ServiceId><ns1:MessageId>350f2d80-ad44-44e5-a635-1fc13dc312df</ns1:MessageId><ns1:SenderTimeStamp>2014-02-19T08:16:23</ns1:SenderTimeStamp></ns1:MessageHeader><ns1:Content><ns1:MimeType>application/xml</ns1:MimeType><ns1:Data encoding="EMBEDDED">196350f2d80-ad44-44e5-a635-1fc13dc312df2014-02-19T08:16:23206344927601HRObavijest o uplati naknade plaæe zbog privremene nesposobnosti za rad, rodiljne i roditeljske potporeUG/CmnRvdmFuYS9pLApOYSBWYcKaIHJhw6h1biBIUjIzMjM5MDAwMTEyMDM1NzYwMzkgdXB1w6ZlbmEgamUgRG9wdXN0IHphIG5qZWd1IGRqLnMgdGXCvmltIHNtZXQuIHUgaXpub3N1IG9kIDIsMTYxLjkwIGt1bmEgemEgMTIuIG1qZXNlYyAyMDEzLiBnb2RpbmUu</ns1:Data></ns1:Content></ns1:GsbEnvelope></ns1:SendMessageRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>

Response:<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><tns:SendMessageResponse xsi:schemaLocation="http://apis-it.hr/umu/2013/types/gsb GSBSchema.xsd " xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://apis-it.hr/umu/2013/types/gsb"><tns:MessageHeader><SenderId xmlns="http://apis-it.hr/umu/2013/types/gsb">24</SenderId><ServiceId xmlns="http://apis-it.hr/umu/2013/types/gsb">123</ServiceId><MessageId xmlns="http://apis-it.hr/umu/2013/types/gsb">350f2d80-ad44-44e5-a635-1fc13dc312df</MessageId><GsbId xmlns="http://apis-it.hr/umu/2013/types/gsb">999e3c1b-9996-475b-a29e-87bd1e8e914f</GsbId><SenderTimeStamp xmlns="http://apis-it.hr/umu/2013/types/gsb">2014-02-19T08:16:23</SenderTimeStamp><ReceivingTimeStamp xmlns="http://apis-it.hr/umu/2013/types/gsb">2014-02-19T08:16:23</ReceivingTimeStamp><ForwardingTimeStamp xmlns="http://apis-it.hr/umu/2013/types/gsb">2014-02-19T08:16:23</ForwardingTimeStamp><ReceiverTimeStamp xmlns="http://apis-it.hr/umu/2013/types/gsb">2014-02-19T08:16:23</ReceiverTimeStamp><ReplyReceivingTimeStamp xmlns="http://apis-it.hr/umu/2013/types/gsb">2014-02-19T08:16:23</ReplyReceivingTimeStamp><ExchangeStatus xmlns="http://apis-it.hr/umu/2013/types/gsb">2</ExchangeStatus></tns:MessageHeader><tns:Content><tns:MimeType>text/xml</tns:MimeType><tns:Data encoding="EMBEDDED"><a:Odgovor xmlns:a="http://apis-it.hr/umu/2013/types/kp"><a:DatumVrijemeObrade>2014-02-19T08:16:23.756+01:00</a:DatumVrijemeObrade><a:Greske><a:Greska><a:SifraGreske>K002</a:SifraGreske><a:OpisGreske>cvc-complex-type.2.3: Element 'KorisnickiPretinacPoruka' cannot have character [children], because the type's content type is element-only.</a:OpisGreske></a:Greska><a:Greska><a:SifraGreske>K002</a:SifraGreske><a:OpisGreske>cvc-complex-type.2.4.b: The content of element 'KorisnickiPretinacPoruka' is not complete. One of '{"http://apis-it.hr/umu/2013/types/kp":Zaglavlje}' is expected.</a:OpisGreske></a:Greska></a:Greske></a:Odgovor></tns:Data></tns:Content></tns:SendMessageResponse></soapenv:Body></soapenv:Envelope>

This is what the XML should look like:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:gsb="http://apis-it.hr/umu/2013/types/gsb">
   <soapenv:Header/>
   <soapenv:Body>
<tns:SendMessageRequest xmlns:tns="http://apis-it.hr/umu/2013/types/gsb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://apis-it.hr/umu/2013/types/gsb ../schema/GSBSchema.xsd ">
  <tns:GsbEnvelope>
    <tns:MessageHeader>
      <tns:SenderId>000000001</tns:SenderId>
      <tns:ServiceId>000000002</tns:ServiceId>
      <tns:MessageId>733362f1-063f-11e2-892e-0802200c9a62</tns:MessageId>
      <tns:SenderTimeStamp>2013-05-31T12:00:00</tns:SenderTimeStamp>
    </tns:MessageHeader>
    <tns:Content>
      <tns:MimeType>application/xml</tns:MimeType>
      <tns:Data encoding="EMBEDDED">
                <tns:KorisnickiPretinacPoruka xmlns:tns="http://apis-it.hr/umu/2013/types/kp"
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xsi:schemaLocation="http://apis-it.hr/umu/2013/types/kp ../schema/KorisnickiPretinacSchema.xsd ">
                    <tns:Zaglavlje>
                        <tns:IdPosiljatelja>000000001</tns:IdPosiljatelja>
                        <tns:IdPoruke>732262f1-063f-11e2-892e-0812200c9a68</tns:IdPoruke>
                        <tns:DatumVrijemeSlanja>2001-12-31T12:00:00</tns:DatumVrijemeSlanja>
                        <tns:RazinaSigurnosti>2</tns:RazinaSigurnosti>
                    </tns:Zaglavlje>
                    <tns:Poruka>
                        <tns:PinPrimatelja>012345678901</tns:PinPrimatelja>
                        <tns:OznakaDrzave>HR</tns:OznakaDrzave>
                        <tns:Predmet>Neka testna poruka</tns:Predmet>
                        <tns:Sadrzaj>U2FkcsW+YWogbmVrZSB0ZXN0bmUgcG9ydWtl</tns:Sadrzaj>
                    </tns:Poruka>
                    <tns:Privici>
                        <tns:Privitak>
                            <tns:Naziv>TestniPrivitak</tns:Naziv>
                            <tns:MimeType>aplication/pdf</tns:MimeType>
                            <tns:Opis>tns:Opis</tns:Opis>
                            <tns:Data encoding="BASE64">
                            JVBERi0xLjcNJeLjz9MNCjc3IDAgb2JqDTw8L0ZpbHRlci9GbG
                            </tns:Data>
                        </tns:Privitak>
                    </tns:Privici>
                </tns:KorisnickiPretinacPoruka>
      </tns:Data>
    </tns:Content>
  </tns:GsbEnvelope>
</tns:SendMessageRequest>
</soapenv:Body> 
</soapenv:Envelope>

I have forgot to add first XSD file (GSBSchema.xsd):

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://apis-it.hr/umu/2013/types/gsb"
    xmlns:tns="http://apis-it.hr/umu/2013/types/gsb" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
    elementFormDefault="qualified">

    <import namespace="http://www.w3.org/2000/09/xmldsig#"
        schemaLocation="../schema/xmldsig-core-schema.xsd" />

    <element name="SendMessageRequest">
        <annotation>
            <documentation>
                Send message service request
            </documentation>
        </annotation>
        <complexType>
            <sequence>
                <element name="GsbEnvelope" type="tns:GsbEnvelopeType" minOccurs="1" maxOccurs="1"/>
            </sequence>
        </complexType>
    </element>

    <element name="SendMessageResponse">
        <annotation>
            <documentation>
                Send message service response
            </documentation>
        </annotation>
        <complexType>
            <sequence>
                <element name="MessageHeader" type="tns:MessageHeaderType" minOccurs="0" maxOccurs="1" />
                <element name="Content" type="tns:ContentType" minOccurs="0" maxOccurs="1" />
                <element name="Errors" type="tns:ErrorsType" minOccurs="0" maxOccurs="1" />
                <element ref="ds:Signature" minOccurs="0" maxOccurs="1" />
            </sequence>
        </complexType>
    </element>

    <element name="EchoRequest" type="string" nillable="false">
        <annotation>
            <documentation>Poruka echo metodi.</documentation>
        </annotation>
    </element>

    <element name="EchoResponse" type="string" nillable="false">
        <annotation>
            <documentation>Odgovor echo metode u obliku: "Request:
                'echoRequest'. Response: 'yyyy-MM-dd'T'HH:mm:ss.SSSZ'.
            </documentation>
        </annotation>
    </element>


    <complexType name="GsbEnvelopeType">
        <annotation>
            <documentation>
                Envelope used in gsb communication
        </documentation>
        </annotation>
        <sequence>
            <element name="MessageHeader" type="tns:MessageHeaderType"
                minOccurs="1" maxOccurs="1" />
            <element ref="ds:Signature" minOccurs="0" maxOccurs="1" />
            <element name="Content" type="tns:ContentType" minOccurs="1"
                maxOccurs="1" />
        </sequence>
    </complexType>

    <complexType name="MessageHeaderType">
        <sequence>
            <element name="SenderId" type="tns:SenderIdType" minOccurs="1" maxOccurs="1" />
            <element name="ServiceId" type="tns:ServiceIdType" minOccurs="1" maxOccurs="1" />
            <element name="AditionalServiceId" type="tns:ServiceIdType" minOccurs="0" maxOccurs="1" />
            <element name="MessageId" type="tns:UUIDType" minOccurs="1" maxOccurs="1" />
            <element name="GsbId" type="tns:UUIDType" minOccurs="0" maxOccurs="1" />
            <element name="SenderTimeStamp" type="dateTime" minOccurs="1" maxOccurs="1" />
            <element name="ReceivingTimeStamp" type="dateTime" minOccurs="0" maxOccurs="1" />
            <element name="ForwardingTimeStamp" type="dateTime" minOccurs="0" maxOccurs="1" />
            <element name="ReceiverTimeStamp" type="dateTime" minOccurs="0" maxOccurs="1" />
            <element name="ReplyReceivingTimeStamp" type="dateTime" minOccurs="0" maxOccurs="1" />
            <element name="ReplyForwardingTimeStamp" type="dateTime" minOccurs="0" maxOccurs="1" />
            <element name="ExchangeStatus" type="tns:StatusType" minOccurs="0" maxOccurs="1" />
        </sequence>
    </complexType>

    <complexType name="ContentType">
        <sequence>
            <element name="MimeType" type="string" minOccurs="1"
                maxOccurs="1" />
            <element name="Description" type="string" minOccurs="0"
                maxOccurs="1">
                <annotation>
                    <documentation>
                        Optional document description. Max lenght 255
                        characters.
            </documentation>
                </annotation>
            </element>
            <element name="Data" minOccurs="1" maxOccurs="1">
                <complexType mixed="true">
                    <sequence minOccurs="0" maxOccurs="unbounded">
                        <any namespace="##any" processContents="lax" />
                    </sequence>
                    <attribute name="encoding" use="required">
                        <simpleType>
                            <restriction base="string">
                                <enumeration value="EMBEDDED" />
                                <enumeration value="BASE64" />
                            </restriction>
                        </simpleType>
                    </attribute>
                    <anyAttribute namespace="##any" />
                </complexType>
            </element>
        </sequence>
    </complexType>

    <complexType name="ErrorsType">
        <sequence>
            <element name="Error" type="tns:ErrorType" minOccurs="1"
                maxOccurs="unbounded" />
        </sequence>
    </complexType>

    <complexType name="ErrorType">
        <sequence>
            <element name="ErrorCode" type="tns:ErrorCodeType" minOccurs="1"
                maxOccurs="1" />
            <element name="ErrorMessage" type="tns:ErrorMessageType"
                minOccurs="1" maxOccurs="1" />
        </sequence>
    </complexType>

    <simpleType name="ErrorCodeType">
        <restriction base="string">
            <pattern value="s[0-9]{3}" />
        </restriction>
    </simpleType>

    <simpleType name="ErrorMessageType">
        <restriction base="string">
            <maxLength value="500" />
        </restriction>
    </simpleType>


    <simpleType name="SenderIdType">
        <restriction base="string">
            <minLength value="1" />
            <maxLength value="9" />
            <pattern value="[0-9]+" />
        </restriction>
    </simpleType>

    <simpleType name="StatusType">
        <restriction base="string">
            <minLength value="1" />
            <maxLength value="1" />
        </restriction>
    </simpleType>

    <simpleType name="ServiceIdType">
        <restriction base="string">
            <minLength value="1" />
            <maxLength value="9" />
            <pattern value="[0-9]+" />
        </restriction>
    </simpleType>

    <simpleType name="UUIDType">
        <restriction base="string">
            <pattern
                value="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}" />
        </restriction>
    </simpleType>

</schema>
  • 写回答

1条回答 默认 最新

  • duanfuxing2417 2014-02-18 16:26
    关注
     "IdPosiljatelja"=>"196"
    

    This is not string as per your schema.

    <complexType name="ZaglavljeType">
        <sequence>
            <element name="IdPosiljatelja" type="tns:PosiljateljIdType" minOccurs="1" maxOccurs="1" />
    

    I think it should be,

    "IdPosiljatelja"=>$PosiljateljIdType
    

    like you have defined for other elements also.

    评论

报告相同问题?

悬赏问题

  • ¥15 NAO机器人的录音程序保存问题
  • ¥15 C#读写EXCEL文件,不同编译
  • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
  • ¥15 扩散模型sd.webui使用时报错“Nonetype”
  • ¥15 stm32流水灯+呼吸灯+外部中断按键
  • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符
  • ¥15 NX MCD仿真与博途通讯不了啥情况
  • ¥15 win11家庭中文版安装docker遇到Hyper-V启用失败解决办法整理
  • ¥15 gradio的web端页面格式不对的问题
  • ¥15 求大家看看Nonce如何配置