ผมอยากปรึกษาคุณ mindphp หรือผู้ที่มีความรู้ Soap นะครับ
จาก
<OTA_HotelAvailNotifRQ xmlns="http://www.opentravel.org/OTA/2003/05" Version="1.0" TimeStamp="2005-08-01T09:30:47+08:00">
<AvailStatusMessages HotelCode="HOTEL">
<AvailStatusMessage BookingLimit="10">
<StatusApplicationControl Start="2010-01-01" End="2010-01-14" InvTypeCode="A1K" RatePlanCode="GLD"/>
</AvailStatusMessage>
</AvailStatusMessages>
</OTA_HotelAvailNotifRQ>
ผมจะเขียน ComplexType ออกมาได้ยังไงครับ เข้าใจว่าคิดให้เหมือนกับโครงสร้าง Array แต่ยังไม่ค่อยเข้าใจโครงสร้างที่จะไปเขียนลง ComplexType พอดียังไม่ค่อยเข้าใจการสร้างสักเท่าไร มันยังมีแบบนี้ที่ต้องทำอีกหลายแบบ คิดว่าถ้าได้ตรงนี้เป็นตัวอย่าง ก็น่าจะเข้าใจสามารถเอาไปทำต่อที่เหลือเองได้ครับ
ใช้ nusoap นะครับ
ขอบคุณล่วงหน้าครับ
สอบถาม ComplexType NuSoap
Moderator: mindphp, ผู้ดูแลกระดาน
-
- PHP Super Member
- โพสต์: 480
- ลงทะเบียนเมื่อ: 25/01/2010 11:57 pm
- ติดต่อ:
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41230
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
Re: สอบถาม ComplexType NuSoap
จะทำเป็น webservice ให้คนอื่นเข้ามาใช้งาน หรอครับ
Nusoap มันเป็น lib เก่ามากเลยนะครับ
Nusoap มันเป็น lib เก่ามากเลยนะครับ
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
-
- PHP Super Member
- โพสต์: 480
- ลงทะเบียนเมื่อ: 25/01/2010 11:57 pm
- ติดต่อ:
Re: สอบถาม ComplexType NuSoap
แล้วปัจจุบันใช้อะไรหรอครับ
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41230
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
Re: สอบถาม ComplexType NuSoap
ใช้ phpSoap เลยครับ
สำหรับ php5 เปิด เค้า build มาใช้ทั้ง Client และ Server แล้วครับ
Soap Client enabled
Soap Server enabled
หรือไม่ก็ ZendSoap ตัว ZendSoap ก็น่าสนใจดีครับ
http://framework.zend.com/manual/1.12/e ... erver.html
ปล. แต่โปรเจคผมก่อนหน้านี้ก็ NuSoap ครับ ง่ะๆ
แต่ไม่อยากแนะนำให้ใช้เพราะมันเก่าถ้ามีปัญหาตัว lib ก็ไม่ได้อัพเดดมานานแล้ว
สำหรับ php5 เปิด เค้า build มาใช้ทั้ง Client และ Server แล้วครับ
Soap Client enabled
Soap Server enabled
หรือไม่ก็ ZendSoap ตัว ZendSoap ก็น่าสนใจดีครับ
http://framework.zend.com/manual/1.12/e ... erver.html
ปล. แต่โปรเจคผมก่อนหน้านี้ก็ NuSoap ครับ ง่ะๆ
แต่ไม่อยากแนะนำให้ใช้เพราะมันเก่าถ้ามีปัญหาตัว lib ก็ไม่ได้อัพเดดมานานแล้ว
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
-
- PHP Super Member
- โพสต์: 480
- ลงทะเบียนเมื่อ: 25/01/2010 11:57 pm
- ติดต่อ:
Re: สอบถาม ComplexType NuSoap
ขอบคุณครับ ตอนนี้ผมไปเขียน Manual เองละ 555 ใช้งานได้เวิคดีครับ ถ้าจะใช้พวกนี้คงต้องใช้เวลานั่งงมกับมันสักพัก แต่นี้งานมันเร่ง เลยไม่มีเวลามานั่งศึกษา ตอนนี้ก็ถืองานคนเดียว 3-4 Project ไม่ไหวๆ ไม่ค่อยได้หลับได้นอนเท่าไรmindphp เขียน:ใช้ phpSoap เลยครับ
สำหรับ php5 เปิด เค้า build มาใช้ทั้ง Client และ Server แล้วครับ
Soap Client enabled
Soap Server enabled
หรือไม่ก็ ZendSoap ตัว ZendSoap ก็น่าสนใจดีครับ
http://framework.zend.com/manual/1.12/e ... erver.html
ปล. แต่โปรเจคผมก่อนหน้านี้ก็ NuSoap ครับ ง่ะๆ
แต่ไม่อยากแนะนำให้ใช้เพราะมันเก่าถ้ามีปัญหาตัว lib ก็ไม่ได้อัพเดดมานานแล้ว
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41230
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
Re: สอบถาม ComplexType NuSoap
เผื่อท่านอื่นเข้ามา อ่านจะได้เก็บไว้เป็นความรู้
ไม่รู้จะทันไหมนะครับ
กระทู้ทีเกี่ยวข้อง
https://www.mindphp.com/forums/viewtopic ... 29&t=12011
https://www.mindphp.com/forums/viewtopic.php?t=2324
โค้ด: เลือกทั้งหมด
<?php
class ResponseObject {
public $responseCode = 0;
public $responseMessage = 'Unknown error!';
public $stuffArray = NULL;
}
/**
* @return object
*/
function getStuffs( $user='', $pass='' ) {
$responseObject = new ResponseObject();
// check stuffs in a simple way now
if( !($user == 'someone' and $pass == '1234') ){
$responseObject->responseCode = 2;
$responseObject->responseMessage = 'Authentication failed!';
return $responseObject;
}
$responseObject->stuffArray = array();
$responseObject->stuffArray[] = array( 'id'=>122, 'name'=>'One stuff');
$responseObject->stuffArray[] = array( 'id'=>213, 'name'=>'Another stuff');
$responseObject->stuffArray[] = array( 'id'=>435, 'name'=>'Whatever stuff');
$responseObject->stuffArray[] = array( 'id'=>65, 'name'=>'Cool Stuff');
$responseObject->stuffArray[] = array( 'id'=>92, 'name'=>'Wow, what a stuff');
$responseObject->responseCode = 1;
$responseObject->responseMessage = 'Successful!';
return $responseObject;
}
require_once 'nusoap/lib/nusoap.php';
$server = new soap_server;
// $myNamespace = $_SERVER['SCRIPT_URI'];
$myNamespace = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
$server->configureWSDL(
// string $serviceName, name of the service
'MyStuffService',
// mixed $namespace optional 'tns' service namespace or false
// 'urn:' . $myNamespace
$myNamespace
);
// $server->wsdl->schemaTargetNamespace = 'http://soapinterop.org/xsd/';
$server->wsdl->schemaTargetNamespace = $myNamespace;
$server->wsdl->addComplexType(
// name
'Stuffs',
// typeClass (complexType|simpleType|attribute)
'complexType',
// phpType: currently supported are array and struct (php assoc array)
'struct',
// compositor (all|sequence|choice)
'all',
// restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
'',
// elements = array ( name = array(name=>'',type=>'') )
array(
'id' => array(
'name' => 'id',
'type' => 'xsd:int'
),
'name' => array(
'name' => 'name',
'type' => 'xsd:string'
)
)
);
$server->wsdl->addComplexType(
// name
'StuffsArray',
// typeClass (complexType|simpleType|attribute)
'complexType',
// phpType: currently supported are array and struct (php assoc array)
'array',
// compositor (all|sequence|choice)
'',
// restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
'SOAP-ENC:Array',
// elements = array ( name = array(name=>'',type=>'') )
array(),
// attrs
array(
array(
'ref' => 'SOAP-ENC:arrayType',
'wsdl:arrayType' => 'tns:Stuffs[]'
)
),
// arrayType: namespace:name (http://www.w3.org/2001/XMLSchema:string)
'tns:Stuffs'
);
$server->wsdl->addComplexType(
// name
'ResponseObject',
// typeClass (complexType|simpleType|attribute)
'complexType',
// phpType: currently supported are array and struct (php assoc array)
'struct',
// compositor (all|sequence|choice)
'all',
// restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
'',
// elements = array ( name = array(name=>'',type=>'') )
array
(
'responseCode' => array( 'type' => 'xsd:int'),
'responseMessage' => array( 'type' => 'xsd:string'),
'stuffArray' => array( 'type' => 'tns:StuffsArray'
// DON'T UNCOMMENT THE FOLLOWING COMMENTED LINES, BECAUSE THIS WAY IT DOESN'T WORK!!! - Left it in the code not to forget it....
// ,
// 'minOccurs' => '0',
// 'maxOccurs' => 'unbounded'
)
)
);
$server->register(
// string $name the name of the PHP function, class.method or class..method
'getStuffs',
// array $in assoc array of input values: key = param name, value = param type
array(
'user' => 'xsd:string',
'pass' => 'xsd:string'
),
// array $out assoc array of output values: key = param name, value = param type
array(
'return' => 'tns:ResponseObject'
),
// mixed $namespace the element namespace for the method or false
// 'urn:' . $myNamespace,
$myNamespace,
// mixed $soapaction the soapaction for the method or false
// 'urn:' . $myNamespace . "#getStuffs",
$myNamespace . "#getStuffs",
// mixed $style optional (rpc|document) or false Note: when 'document' is specified, parameter and return wrappers are created for you automatically
'rpc',
// mixed $use optional (encoded|literal) or false
'encoded',
// string $documentation optional Description to include in WSDL
'Fetch array of Stuffs ("id", "name").' // documentation
);
// $server->wsdl->schemaTargetNamespace = $myNamespace;
// function def.: nusoap/lib/class.soap_server.php
$server->service(isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '');
exit(0);
กระทู้ทีเกี่ยวข้อง
https://www.mindphp.com/forums/viewtopic ... 29&t=12011
https://www.mindphp.com/forums/viewtopic.php?t=2324
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
-
- Similar Topics
- ตอบกลับ
- แสดง
- โพสต์ล่าสุด
-
-
โพสต์ใหม่ Q สอบถามลองเขียน php webservice ด้วย nuSoap แล้วขึ้น Error ครับ
โดย birdkritsna » 05/10/2019 5:37 pm » ใน Programming - PHP - 10 ตอบกลับ
- 1864 แสดง
-
โพสต์ล่าสุด โดย birdkritsna
10/10/2019 10:29 am
-
-
-
โพสต์ใหม่ สอบถาม เกี่ยวกับการเครมภาษีย้อนหลัง
โดย Likit » 21/07/2022 10:36 am » ใน ถาม - ตอบ ธุรกิจ กฏหมาย ภาษี บัญชี - 1 ตอบกลับ
- 1505 แสดง
-
โพสต์ล่าสุด โดย mindphp
24/07/2022 2:50 pm
-
-
- 2 ตอบกลับ
- 52702 แสดง
-
โพสต์ล่าสุด โดย suhaila
23/06/2021 3:46 pm
-
- 2 ตอบกลับ
- 1703 แสดง
-
โพสต์ล่าสุด โดย hayatee
14/06/2021 5:34 pm
-
- 1 ตอบกลับ
- 2087 แสดง
-
โพสต์ล่าสุด โดย mindphp
19/09/2020 4:21 pm
ผู้ใช้งานขณะนี้
สมาชิกกำลังดูบอร์ดนี้: Amazon [Bot] และบุคลทั่วไป 113