Page 1 of 1

Sending XML to a WSDL Webservice

Posted: Mon Mar 19, 2007 9:18 am
by Fredrik Olof
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Ok, I have this XML code that works fine if I send it, to a WSDL web service, via a program called SOAPSonar. I would like to use NuSoap (or any other PHP compatible library) to do the same request. I have the client already connected and everything in place but I cannot get it to work exactly like SOAPSonar. There seems to be some problem when it comes to getting the service to understand exactly what I send it.

Does anyone have any idea about this, this cannot be that hard tbh (I am an XML/SOAP newbie). Basically I just want to send the service this raw XML:

[syntax="xml"]
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://net.sfd.se/WebService/CKDB" xmlns:s="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <tns:SoapAuthenticator>
      <tns:UserId>XXXXX</tns:UserId>
      <tns:Password>XXXXXXXXXXXXXXXXXX</tns:Password>
    </tns:SoapAuthenticator>
  </soap:Header>
  <soap:Body>
    <tns:Save>
      <tns:strTransactionId>ADD_ADR_DISTRIBUTED</tns:strTransactionId>
      <tns:intDBSpace>XXXXXX</tns:intDBSpace>
      <tns:dsSave>
        <xs:schema id="ADD_ADR_DISTRIBUTED" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
          <xs:element name="ADD_ADR_DISTRIBUTED" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
            <xs:complexType>
              <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:element name="EgetAdr">
                  <xs:complexType>
                    <xs:sequence>
                      <xs:element name="Foretag" minOccurs="0">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:maxLength value="50" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:element>
                      <xs:element name="Namn" minOccurs="0">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:maxLength value="50" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:element>
                      <xs:element name="ENamn" minOccurs="0">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:maxLength value="40" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:element>
                      <xs:element name="Adress" minOccurs="0">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:maxLength value="2147483647" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:element>
                      <xs:element name="Personnr" minOccurs="0">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:maxLength value="15" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:element>
                      <xs:element name="TelArb" minOccurs="0">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:maxLength value="17" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:element>
                      <xs:element name="TelBost" minOccurs="0">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:maxLength value="17" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:element>
                      <xs:element name="TelMobil" minOccurs="0">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:maxLength value="17" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:element>
                      <xs:element name="TelAnnat" minOccurs="0">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:maxLength value="17" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:element>
                      <xs:element name="Fax" minOccurs="0">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:maxLength value="17" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:element>
                      <xs:element name="Email" minOccurs="0">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:maxLength value="100" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:element>
                      <xs:element name="Hemsida" minOccurs="0">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:maxLength value="100" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:element>
                      <xs:element name="Anteckning" minOccurs="0">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:maxLength value="2147483647" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:element>
                      <xs:element name="ChangeDate" type="xs:dateTime" minOccurs="0" />
                      <xs:element name="NyAdress" minOccurs="0">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:maxLength value="2147483647" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:element>
                      <xs:element name="Inkomst" type="xs:int" minOccurs="0" />
                      <xs:element name="RegDatum" type="xs:dateTime" minOccurs="0" />
                      <xs:element name="AktDatum" type="xs:dateTime" minOccurs="0" />
                      <xs:element name="NyAdressFrom" type="xs:dateTime" minOccurs="0" />
                      <xs:element name="EjUtskick" type="xs:boolean" minOccurs="0" />
                      <xs:element name="UserGID" minOccurs="0">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:maxLength value="40" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:element>
                      <xs:element name="GID" default="ADR">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:maxLength value="40" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:element>
                      <xs:element name="MasterGID" minOccurs="0">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:maxLength value="40" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:element>
                      <xs:element name="ClassGID" default="CLS_ADR_PERSON" minOccurs="0">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:maxLength value="40" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:element>
                      <xs:element name="FNamn" minOccurs="0">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:maxLength value="40" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:element>
                      <xs:element name="Email2" minOccurs="0">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:maxLength value="100" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:element>
                      <xs:element name="Postnr" type="xs:int" minOccurs="0" />
                      <xs:element name="Postort" minOccurs="0">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:maxLength value="25" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:element>
                      <xs:element name="NyPostnr" type="xs:int" minOccurs="0" />
                      <xs:element name="NyPostort" minOccurs="0">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:maxLength value="25" />
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:element>
                    </xs:sequence>
                  </xs:complexType>
                </xs:element>
              </xs:choice>
            </xs:complexType>
            <xs:unique name="Constraint1" msdata:PrimaryKey="true">
              <xs:selector xpath=".//ToDo" />
              <xs:field xpath="GID" />
            </xs:unique>
            <xs:unique name="Log_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
              <xs:selector xpath=".//Log" />
              <xs:field xpath="GID" />
            </xs:unique>
          </xs:element>
        </xs:schema>
        <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
          <EgetAdr>
            <EgetAdr diffgr:id="EgetAdr1" msdata:rowOrder="0" diffgr:hasChanges="inserted">
              <Namn>Fredrik Testar!</Namn>
              <RegDatum>2007-03-16T00:00:00+01:00</RegDatum>
              <AktDatum>2007-03-16T00:00:00+01:00</AktDatum>
              <GID>ADR5FAD7FF29DFA4B708B21B0F72245EB6E</GID>
              <ClassGID>CLS_ADR_PERSON</ClassGID>
            </EgetAdr>
          </EgetAdr>
        </diffgr:diffgram>
      </tns:dsSave>
    </tns:Save>
  </soap:Body>
</soap:Envelope>

feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]