Pages

Showing posts with label web service. Show all posts
Showing posts with label web service. Show all posts

Wednesday, June 2, 2010

How to attachments file in web service

นั่นสิครับ เจอคำถามนี้เข้าไปผมก็เลยงง เลยครับ ปกติการส่ง data between more than 2 services like message (Soap message) แต่ถ้าผมต้องการจะแนบไฟล์ไปกับ response message หละ ทำยังไงดี - -"

เดี่ยวบ่ายนี้มีคำตอบ

Web Service Standards Listings

พอมีเวลาว่างสักหน่อยก็เป็นว่าต้องหาอะไร มาอ่านอยู่เรื่องเลย จริง ๆ เรื่องที่อ่านเนี่ย ก็พอมีความรู้อยู่บ้างนิดหน่อยแต่ก็กลัวว่าจะลืม เลยมารื้อฟื้นความรู้ซะหน่อยเกี่ยวกับ webservice เกี่ยวกับเรื่อง Web Service Standards และก็ไปเจอใน wiki บอกได้คำเดียวว่าเยอะมาก ๆ สงสัยอ่านจนตาลายแน่ ๆ ^^

Web Service Standards Listings

These sites contain documents and links about the different Web Services standards identified on this page.


XML Specification


Messaging Specification


Metadata Exchange Specification


Security Specification


Privacy


Reliable Messaging Specifications


Resource Specifications


Web Services Interoperability (WS-I) Specification

These specifications provide additional information to improve interoperability between vendor implementations.


Business Process Specifications


Transaction Specifications


Management Specifications


Presentation Oriented Specification


Draft Specifications

  • WS-Provisioning Describes the APIs and Schemas necessary to facilitate interoperability between provisioning systems in a consistent manner using Web services


Other

Friday, January 15, 2010

PHP5 Consume .Net Web service

error_reporting(E_ALL);
$ValidateEmail = new SoapClient("http://www.webservicex.net/ValidateEmail.asmx?wsdl");
$email = array("Email" => "me@somewhere.com");
try {
$response = $ValidateEmail->IsValidEmail($email);
if ($response->IsValidEmailResult) {
echo $email["Email"] . " is a valid email address";
} else {
echo $email["Email"] . " is not a valid email address";
}
} catch (SoapFault $fault) {
//LOG IF YOU WANT
echo $email["Email"] . " is not a valid email address";
}

echo '
' . var_dump($response) . '
';
?>

Thursday, January 14, 2010

WSDL vs. non-WSDL Modes

พอดีวันนี้ จำเป็นที่จะต้อง consume .net web service using php5 with soap extesion แล้วไปเจอเขากับ article ที่ : http://wso2.org/library/1060
เขาจะพูดเรื่องของ php soap extension แล้วผ่านไปมาเจอกับ web service module 2 แบบ คือ
1. WSDL model
2. non-WSDL model

เลยลองอ่านเพิ่มเติม ประกฏว่าได้เรื่องดังนี้ครับ (ไม่แน่ใจว่าผมเข้าใจถูกหรือเปล่าว)

สำหรับการ implement web service จะมีอยู่ 2 models ด้วยกันคือ
1. Contract First model
2. Code First model

สอง model นี้มันต่างกันยังไง

อันแรก Contact first model จะมี WSDL เป็นตัวที่ใช้อธิบาย detail ของ web service ซึ่งภายในก็จะอธิบายถึงการ implement and consume

อันหลัง Code first model. In the code first model, the code implementing the service is written first. Then in most cases a contract, in other words a WSDL, is generated out of the code. Then the client can use that WSDL, at the time of consuming the service, to take note of the interface of the service. However, the PHP 5's SOAP extension does not have provisions for generating a WSDL out of the code. To cater for this situation, the non-WSDL mode of the SoapServer and SoapClient can be used.

ง่าย ๆ คือ php extension นี้จะไม่มีการ generate wsdl ให้ เหมือนใน nusoap