Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Hi all of you !!!
I had to program a SOAP Client to connect to a .NET Server.
But I had to create a SOAP message which have to include
a previously given schema (included in this post).
But I don't know how to include the schema as part of the Soap message.
Can you help me?
This is my code so far (this code works with other functions in this server):Code: Select all
<?php
require_once('nusoap.php');
$soapclient->debug_flag = 1;
$params = array(
'usuario' => "test",
'password' => "test1"
);
$namespace="http://tempuri.org/";
$soapaction="http://tempuri.org/CargaRemision";
$soapclient = new soapclient("http://www.soriana.com/sprov/ColaboracionElectronica/Pruebas/ServiciosWeb/RemisionElectronica/svcCargaRemision.asmx");
if($err = $soapclient->getError())
{
// handle error however
print_r ($err);
}
else
{
$result = $soapclient->call("CargaRemision",$params,$namespace,$soapaction,false,null,'rpc','literal');
if($err2 = $soapclient->getError())
{
print_r ($err2);
echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($soapclient->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($soapclient->response, ENT_QUOTES) . '</pre>';
echo '<h2>Debug</h2>';
echo '<pre>' . htmlspecialchars($soapclient->debug_str, ENT_QUOTES) . '</pre>';
}
else
{
// do something w/ return val
print_r ($result);
}
}
?>This is the SOAP message that I had to create:
Code: Select all
POST /sprov/ColaboracionElectronica/Pruebas/ServiciosWeb/RemisionElectronica/svcValidaRemision.asmx HTTP/1.1
Host: www.soriana.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/ValidaRemision"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ValidaRemision xmlns="http://tempuri.org/">
<dsCargaRemision>
<xsd:schema>schema</xsd:schema>xml</dsCargaRemision>
<Usuario>string</Usuario>
<Contrasena>string</Contrasena>
</ValidaRemision>
</soap:Body>
</soap:Envelope>And this is the SCHEMA:
Code: Select all
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="DSCargaRemisionProv" targetNamespace="http://tempuri.org/DSCargaRemisionProv.xsd" elementFormDefault="qualified" attributeFormDefault="qualified" xmlns="http://tempuri.org/DSCargaRemisionProv.xsd" xmlns:mstns="http://tempuri.org/DSCargaRemisionProv.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="DSCargaRemisionProv" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Remision">
<xs:complexType>
<xs:sequence>
<xs:element name="Proveedor" type="xs:int" />
<xs:element name="Remision" type="xs:string" />
<xs:element name="Consecutivo" type="xs:short" />
<xs:element name="FechaRemision" type="xs:dateTime" />
<xs:element name="Tienda" type="xs:short" />
<xs:element name="TipoMoneda" type="xs:short" />
<xs:element name="TipoBulto" type="xs:short" />
<xs:element name="EntregaMercancia" type="xs:short" />
<xs:element name="CumpleReqFiscales" type="xs:boolean" />
<xs:element name="CantidadBultos" type="xs:decimal" />
<xs:element name="Subtotal" type="xs:decimal" />
<xs:element name="Descuentos" type="xs:decimal" />
<xs:element name="IEPS" type="xs:decimal" />
<xs:element name="IVA" type="xs:decimal" />
<xs:element name="OtrosImpuestos" type="xs:decimal" />
<xs:element name="Total" type="xs:decimal" />
<xs:element name="CantidadPedidos" type="xs:int" />
<xs:element name="FechaEntregaMercancia" type="xs:dateTime" nillable="true" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Pedimento">
<xs:complexType>
<xs:sequence>
<xs:element name="Proveedor" type="xs:int" />
<xs:element name="Remision" type="xs:string" />
<xs:element name="Pedimento" type="xs:int" />
<xs:element name="Aduana" type="xs:short" />
<xs:element name="AgenteAduanal" type="xs:short" />
<xs:element name="TipoPedimento" type="xs:string" />
<xs:element name="FechaPedimento" type="xs:dateTime" />
<xs:element name="FechaReciboLaredo" type="xs:dateTime" />
<xs:element name="FechaBillOfLading" type="xs:dateTime" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Pedidos">
<xs:complexType>
<xs:sequence>
<xs:element name="Proveedor" type="xs:int" />
<xs:element name="Remision" type="xs:string" />
<xs:element name="FolioPedido" type="xs:int" />
<xs:element name="Tienda" type="xs:short" />
<xs:element name="CantidadArticulos" type="xs:int" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Articulos">
<xs:complexType>
<xs:sequence>
<xs:element name="Proveedor" type="xs:int" />
<xs:element name="Remision" type="xs:string" />
<xs:element name="FolioPedido" type="xs:int" />
<xs:element name="Tienda" type="xs:short" />
<xs:element name="Codigo" type="xs:decimal" />
<xs:element name="CantidadUnidadCompra" type="xs:decimal" />
<xs:element name="CostoNetoUnidadCompra" type="xs:decimal" />
<xs:element name="PorcentajeIEPS" type="xs:decimal" />
<xs:element name="PorcentajeIVA" type="xs:decimal" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:key name="DSCargaRemisionProvKey1" msdata:PrimaryKey="true">
<xs:selector xpath=".//Remision" />
<xs:field xpath="mstns:Proveedor" />
<xs:field xpath="Remision" />
</xs:key>
<xs:key name="DSCargaRemisionProvKey3" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:Pedimento" />
<xs:field xpath="mstns:Proveedor" />
<xs:field xpath="Remision" />
</xs:key>
<xs:key name="DSCargaRemisionProvKey4" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:Pedidos" />
<xs:field xpath="mstns:Proveedor" />
<xs:field xpath="Remision" />
<xs:field xpath="mstns:FolioPedido" />
</xs:key>
<xs:key name="DSCargaRemisionProvKey5" msdata:PrimaryKey="true">
<xs:selector xpath=".//Articulos" />
<xs:field xpath="mstns:Proveedor" />
<xs:field xpath="mstns:Remision" />
<xs:field xpath="mstns:FolioPedido" />
<xs:field xpath="mstns:Tienda" />
<xs:field xpath="mstns:Codigo" />
</xs:key>
<xs:keyref name="RemisionPedimento" refer="DSCargaRemisionProvKey1">
<xs:selector xpath=".//mstns:Pedimento" />
<xs:field xpath="mstns:Proveedor" />
<xs:field xpath="Remision" />
</xs:keyref>
<xs:keyref name="RemisionPedidos" refer="DSCargaRemisionProvKey1">
<xs:selector xpath=".//mstns:Pedidos" />
<xs:field xpath="mstns:Proveedor" />
<xs:field xpath="Remision" />
</xs:keyref>
<xs:keyref name="PedidosArticulos" refer="DSCargaRemisionProvKey4">
<xs:selector xpath=".//mstns:Articulos" />
<xs:field xpath="mstns:Proveedor" />
<xs:field xpath="Remision" />
<xs:field xpath="mstns:FolioPedido" />
</xs:keyref>
<xs:key name="DSCargaRemisionProvKey6" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:Articulos" />
<xs:field xpath="mstns:Proveedor" />
<xs:field xpath="Remision" />
<xs:field xpath="mstns:FolioPedido" />
<xs:field xpath="mstns:Tienda" />
<xs:field xpath="mstns:Codigo" />
</xs:key>
</xs:element>
</xs:schema>feyd | Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]