Avatar billede bjarkekr Nybegynder
20. oktober 2006 - 10:31 Der er 2 kommentarer og
1 løsning

modtage soap attachment

Hejsa!

Hvordan modtager man en soap attachment i php?? Bruger php_soap.dll til min soap server og altså ikke pear eller nusoap.

Her kan ses min server fil:
<?
require('include/database.php');

class booking {
    private $incPath = 'include/';
   
  function updateServerStatus($user, $pass, $status){
    global $mysqli, $userid;
        if (connect($user, $pass)){
      require($this->incPath."updateserverstatus.php");
      disconnect();
    }else
      $result .= 'Login failed';
    return $result;
  }
 
  function updateMap($user, $pass, $map, $h, $w){
        global $mysqli, $userid;
        if (connect($user, $pass)){
      //require($this->incPath."updateMap.php");
            require($this->incPath."updateserverstatus.php");
      disconnect();
    }else
      $result .= 'Login failed';
    return $result;
    }
 
  function updateEnhedsKat($user, $pass, $enhedsKat, $action){
        global $mysqli, $userid;
        if (connect($user, $pass)){
      require($this->incPath."updateEnhedsKat.php");

      disconnect();
    }else
      $result .= 'Login failed';
    return $result;
    }
   
    function updateEnheder($user, $pass, $enheder, $action){
        global $mysqli, $userid;
        if (connect($user, $pass)){
      require($this->incPath."updateEnheder.php");
            require($this->incPath."updateserverstatus.php");
      disconnect();
    }else
      $result .= 'Login failed';
    return $result;
    }

} //end class

$server = new SoapServer(NULL ,array('uri' => "http://localhost:8080/booking/"));
$server->setClass("booking");
$server->handle();
?>


Den function der skal modtage min attachment får fejlen "Bad request".

Det der sendes til serveren ser således ud:
--MIME_boundaryB0R9532143182121
Content-Type: text/xml
SOAPAction: "urn:soap-webOneBookingService#updateMap"
Content-ID: <http://www.borland.com/rootpart.xml>
Content-Location: http://www.borland.com/rootpart.xml
Content-Length: 693

<?xml version="1.0"?>
<SOAP-ENV:Envelope 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/"><SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:NS2="urn:soap"><NS1:updateMap xmlns:NS1="urn:soap-webOneBookingService"><user xsi:type="xsd:string">TEST</user><pass xsi:type="xsd:string">TEST</pass><image href="#1"/><h xsi:type="xsd:int">438</h><w xsi:type="xsd:int">687</w></NS1:updateMap><NS2:Tmap id="1" href="cid:E707486A-BC60-4474-BA36-6739AC2E75EB"/></SOAP-ENV:Body></SOAP-ENV:Envelope>


--MIME_boundaryB0R9532143182121
Content-ID: <E707486A-BC60-4474-BA36-6739AC2E75EB>
Content-Length: 0
Content-Type: application/binary
Content-transfer-encoding: binary


--MIME_boundaryB0R9532143182121--


Her er det xml min webservice returnere:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Client</faultcode><faultstring>Bad Request</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
Avatar billede bjarkekr Nybegynder
20. oktober 2006 - 11:29 #1
Når, fandt ud af at min attachment slet ikke blev sendt med.. Så nu poster jeg lige den sendte xml her igen.

--MIME_boundaryB0R9532143182121
Content-Type: text/xml
SOAPAction: "urn:soap-webOneBookingService#updateMap"
Content-ID: <http://www.borland.com/rootpart.xml>
Content-Location: http://www.borland.com/rootpart.xml
Content-Length: 644

<?xml version="1.0"?>
<SOAP-ENV:Envelope 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/"><SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><NS1:updateMap xmlns:NS1="urn:soap-webOneBookingService"><user xsi:type="xsd:string">TEST</user><pass xsi:type="xsd:string">TEST</pass><image href="cid:2CB9DF03-5429-43E5-8A9C-F77C5BF01E5B"/><h xsi:type="xsd:int">438</h><w xsi:type="xsd:int">687</w></NS1:updateMap></SOAP-ENV:Body></SOAP-ENV:Envelope>


--MIME_boundaryB0R9532143182121
Content-ID: <2CB9DF03-5429-43E5-8A9C-F77C5BF01E5B>
Content-Length: 167316
Content-Type: application/binary

//Her er mit binære stream

--MIME_boundaryB0R9532143182121--
Avatar billede bjarkekr Nybegynder
20. oktober 2006 - 12:48 #2
Nå.. Nu har jeg selv fundet løsningen...

Jeg dropper at sende og modtage en soapattachment og encoder i stedet mit binære data til en base64 string. som jeg decoder i php.. Det virker.
Avatar billede bjarkekr Nybegynder
20. oktober 2006 - 12:48 #3
lukker
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester