[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wsf-c-commits
Subject:    [Wsf-c-commits] svn commit r16369 -
From:       svn () wso2 ! org
Date:       2008-04-30 7:57:49
Message-ID: E1Jr7CH-0003eo-3P () wso2 ! org
[Download RAW message or body]

Author: dimuthu
Date: Wed Apr 30 00:57:43 2008
New Revision: 16369

Log:

Adding Mime service


Added:
   trunk/wsf/php/src/tests/samples/services/wsdl_mode/Mime.wsdl   (contents, props \
changed)  trunk/wsf/php/src/tests/samples/services/wsdl_mode/MimeService.php
   trunk/wsf/php/src/tests/samples/services/wsdl_mode/xmime.xsd   (contents, props \
changed) Modified:
   trunk/wsf/php/src/tests/samples/services/wsdl_mode/new.xml

Added: trunk/wsf/php/src/tests/samples/services/wsdl_mode/Mime.wsdl
==============================================================================
--- (empty file)
+++ trunk/wsf/php/src/tests/samples/services/wsdl_mode/Mime.wsdl	Wed Apr 30 00:57:43 \
2008 @@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions
+	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+	xmlns:ns1="http://ws.apache.org/axis2/xsd"
+	xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
+	xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+	xmlns:ns0="http://ws.apache.org/axis2"
+	xmlns:xs="http://www.w3.org/2001/XMLSchema"
+	xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+	xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
+	targetNamespace="http://ws.apache.org/axis2"
+	
+	xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
+	>
+    <wsdl:types>
+	
+        <xs:schema xmlns:ns="http://ws.apache.org/axis2" \
attributeFormDefault="qualified" elementFormDefault="qualified" \
targetNamespace="http://ws.apache.org/axis2"> +            <xs:element \
name="getPerson"> +                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element minOccurs="0" name="param0" type="xs:int"/>
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="getPersonResponse">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element minOccurs="0" name="return" nillable="true" \
type="ns1:Person"/> +                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="setPerson">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element minOccurs="0" name="param0" nillable="true" \
type="ns1:Person"/> +                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="setPersonResponse">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element minOccurs="0" name="return" type="xs:int"/>
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+        </xs:schema>
+        <xs:schema xmlns:ax21="http://ws.apache.org/axis2/xsd" \
attributeFormDefault="qualified" elementFormDefault="qualified" \
targetNamespace="http://ws.apache.org/axis2/xsd"> +		
+			<xs:import namespace="http://www.w3.org/2005/05/xmlmime"
+				schemaLocation="http://localhost/services/wsdl_mode/xmime.xsd"/>
+		
+            <xs:complexType name="Person">
+                <xs:sequence>
+                    <xs:element minOccurs="0" name="age" type="xs:int"/>
+                    <xs:element maxOccurs="unbounded" minOccurs="0" name="images" \
nillable="true" type="xmime:base64Binary"/> +                    <xs:element \
maxOccurs="unbounded" minOccurs="0" name="someInts" nillable="true" type="xs:int"/> + \
<xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/> +            \
<xs:element maxOccurs="unbounded" minOccurs="0" name="someStrings" nillable="true" \
type="xs:string"/> +                </xs:sequence>
+            </xs:complexType>
+        </xs:schema>
+    </wsdl:types>
+    <wsdl:message name="getPersonRequest">
+        <wsdl:part name="parameters" element="ns0:getPerson"/>
+    </wsdl:message>
+    <wsdl:message name="getPersonResponse">
+        <wsdl:part name="parameters" element="ns0:getPersonResponse"/>
+    </wsdl:message>
+    <wsdl:message name="setPersonRequest">
+        <wsdl:part name="parameters" element="ns0:setPerson"/>
+    </wsdl:message>
+    <wsdl:message name="setPersonResponse">
+        <wsdl:part name="parameters" element="ns0:setPersonResponse"/>
+    </wsdl:message>
+    <wsdl:portType name="aServicePortType">
+        <wsdl:operation name="getPerson">
+            <wsdl:input message="ns0:getPersonRequest" wsaw:Action="urn:getPerson"/>
+            <wsdl:output message="ns0:getPersonResponse" \
wsaw:Action="urn:getPersonResponse"/> +        </wsdl:operation>
+        <wsdl:operation name="setPerson">
+            <wsdl:input message="ns0:setPersonRequest" wsaw:Action="urn:setPerson"/>
+            <wsdl:output message="ns0:setPersonResponse" \
wsaw:Action="urn:setPersonResponse"/> +        </wsdl:operation>
+    </wsdl:portType>
+    <wsdl:binding name="aServiceSOAP11Binding" type="ns0:aServicePortType">
+        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" \
style="document"/> +        <wsdl:operation name="getPerson">
+            <soap:operation soapAction="urn:getPerson" style="document"/>
+            <wsdl:input>
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        <wsdl:operation name="setPerson">
+            <soap:operation soapAction="urn:setPerson" style="document"/>
+            <wsdl:input>
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:binding name="aServiceSOAP12Binding" type="ns0:aServicePortType">
+        <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" \
style="document"/> +        <wsdl:operation name="getPerson">
+            <soap12:operation soapAction="urn:getPerson" style="document"/>
+            <wsdl:input>
+                <soap12:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap12:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        <wsdl:operation name="setPerson">
+            <soap12:operation soapAction="urn:setPerson" style="document"/>
+            <wsdl:input>
+                <soap12:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap12:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:binding name="aServiceHttpBinding" type="ns0:aServicePortType">
+        <http:binding verb="POST"/>
+        <wsdl:operation name="getPerson">
+            <http:operation location="aService/getPerson"/>
+            <wsdl:input>
+                <mime:content type="text/xml" part="getPerson"/>
+            </wsdl:input>
+            <wsdl:output>
+                <mime:content type="text/xml" part="getPerson"/>
+            </wsdl:output>
+        </wsdl:operation>
+        <wsdl:operation name="setPerson">
+            <http:operation location="aService/setPerson"/>
+            <wsdl:input>
+                <mime:content type="text/xml" part="setPerson"/>
+            </wsdl:input>
+            <wsdl:output>
+                <mime:content type="text/xml" part="setPerson"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:service name="aService">
+        <wsdl:port name="aServiceSOAP11port_http" \
binding="ns0:aServiceSOAP11Binding"> +            <soap:address \
location="http://localhost/services/wsdl_mode/MimeService.php"/> +        \
</wsdl:port> +        <wsdl:port name="aServiceSOAP12port_http" \
binding="ns0:aServiceSOAP12Binding"> +            <soap12:address \
location="http://localhost:8080/axis2/services/aService"/> +        </wsdl:port>
+        <wsdl:port name="aServiceHttpport" binding="ns0:aServiceHttpBinding">
+            <http:address location="http://localhost:8080/axis2/services/aService"/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>

Added: trunk/wsf/php/src/tests/samples/services/wsdl_mode/MimeService.php
==============================================================================
--- (empty file)
+++ trunk/wsf/php/src/tests/samples/services/wsdl_mode/MimeService.php	Wed Apr 30 \
00:57:43 2008 @@ -0,0 +1,101 @@
+<?php
+
+// PHP classes corresponding to the data types in defined in WSDL
+
+class getPerson {
+    public $param0; // int
+}
+
+class getPersonResponse {
+    public $return; // Person
+}
+
+class Person {
+    public $age; // int
+    public $images; // array[0, unbounded] of base64Binary
+    public $someInts; // array[0, unbounded] of int
+    public $name; // string
+    public $someStrings; // array[0, unbounded] of string
+}
+
+class base64Binary {
+    //NOTE:  should follow the following restrictions
+    /* Your length of the value should be 
+       Greater than 3
+     */
+    public $contentType; // string
+    // The "value" represents the element 'images' value..
+    public $value; // base64Binary
+}
+
+class setPerson {
+    public $param0; // Person
+}
+
+class setPersonResponse {
+    public $return; // int
+}
+
+// define the class map
+$class_map = array(
+ "anyType" => "anyType", "getPerson" => "getPerson", "getPersonResponse" => \
"getPersonResponse", "Person" => "Person", "base64Binary" => "base64Binary", \
"setPerson" => "setPerson", "setPersonResponse" => "setPersonResponse"); +
+// define PHP functions that maps to WSDL operations 
+function getPerson($input) {
+    // TODO: fill in the business logic
+    // NOTE: $input is of type getPerson
+    // NOTE: should return an object of type getPersonResponse
+
+    $ppl = new Person();
+    $ppl->age = 3;
+    $bin1 = new base64Binary();
+    $bin1->contentType = "image/jpeg";
+    $bin1->value = "xxxxx";
+
+    $bin2 = new base64Binary();
+    $bin2->contentType = "image/jpeg";
+    $bin2->value = "yyyy";
+    $ppl->images = array($bin1, $bin2);
+    $ppl->someInts = array(5, 6);
+    $ppl->name = "test";
+    $ppl->someStrings = array("test1", "test2");
+
+    $ret = new getPersonResponse();
+    $ret->return = $ppl;
+
+    return $ret;
+}
+
+
+function setPerson($input) {
+    // TODO: fill in the business logic
+    // NOTE: $input is of type setPerson
+    // NOTE: should return an object of type setPersonResponse
+
+    file_put_contents("/tmp/something", print_r($input, TRUE));
+    $x =new setPersonResponse();
+    $x->return = 5;
+    return $x;
+}
+
+
+// define the operations map
+$operations = array(
+ "getPerson" => "getPerson", "setPerson" => "setPerson");
+
+// define the actions => operations map
+$actions = array(
+ "urn:getPerson" => "getPerson", "urn:setPerson" => "setPerson");
+
+// create service in WSDL mode
+$service = new WSService(array ("wsdl" =>"Mime.wsdl",
+        "operations" => $operations,
+        "opParams" => $opParams,
+        "actions" => $actions,
+        "classmap" => $class_map,
+                            ));
+
+// process client requests and reply 
+$service->reply();
+
+?>

Modified: trunk/wsf/php/src/tests/samples/services/wsdl_mode/new.xml
==============================================================================
--- trunk/wsf/php/src/tests/samples/services/wsdl_mode/new.xml	(original)
+++ trunk/wsf/php/src/tests/samples/services/wsdl_mode/new.xml	Wed Apr 30 00:57:43 \
2008 @@ -1,28 +1,24 @@
 <?xml version="1.0"?>
 <services xmlns:xs="http://www.w3.org/2001/XMLSchema">
-    <service name="MyService" endpoint="MyServiceSOAP12port_http" \
address="http://localhost:8080/dyn/codegen/demo/services/MyService" type="SOAP12"> +  \
<service name="MyService" endpoint="MyServiceSOAP12port_http" \
address="http://localhost/services/wsdl_mode/AttributeService.php" type="SOAP12">  \
<documentation/>  <operations name="MyServicePortType">
             <operation name="myDemo" pattern="http://www.w3.org/ns/wsdl/in-out" \
safe="false">  <documentation/>
                 <signature method="inference">
-                    <params>
-                        <param name="myDemo" token="#in" type="myunion" \
type-namespace="http://www.w3.org/2001/XMLSchema" \
                targetNamespace="http://wso2.org/dyn/codegen/demo" simple="yes" \
                union="yes">
-                            <union simple="yes" type="string">
-                                <enumeration value="banana"/>
-                                <enumeration value="oragne"/>
-                            </union>
-                            <union simple="yes" type="string">
-                                <enumeartion value="icecream"/>
-                                <enumeration value="salad"/>
-                            </union>
+                    <params wrapper-element="myDemo" \
wrapper-element-ns="http://wso2.org/dyn/codegen/demo" simple="no" \
contentModel="sequence"> +                        <param token="#in" \
targetNamespace="http://wso2.org/dyn/codegen/demo" minOccurs="1" maxOccurs="1" \
name="demo1" type="string" type-namespace="http://www.w3.org/2001/XMLSchema" \
type-prefix="xs" simple="yes"/> +                        <param token="#in" \
targetNamespace="http://wso2.org/dyn/codegen/demo" minOccurs="1" maxOccurs="1" \
name="demo2" type="string" type-namespace="http://www.w3.org/2001/XMLSchema" \
type-prefix="xs" simple="yes"/> +                        <param attribute="yes" \
token="#in" targetNamespace="http://wso2.org/dyn/codegen/demo" name="demo3" \
type="int" type-namespace="http://wso2.org/dyn/codegen/demo" simple="yes"> +          \
<maxInclusive value="5"/> +                            <minInclusive value="2"/>
                         </param>
                     </params>
                     <returns>
-                        <param name="myDemoResponse" token="#in" type="int" \
type-namespace="http://www.w3.org/2001/XMLSchema" simple="yes" \
targetNamespace="http://wso2.org/dyn/codegen/demo"/> +                        <param \
name="myDemoResponse" token="#in" type="string" \
type-namespace="http://www.w3.org/2001/XMLSchema" simple="yes" \
targetNamespace="http://wso2.org/dyn/codegen/demo"/>  </returns>
                 </signature>
-                <binding-details wsawaction="urn:myDemo" soapaction="urn:myDemo"/>
+                <binding-details soapaction="urn:myDemo"/>
             </operation>
         </operations>
     </service>

Added: trunk/wsf/php/src/tests/samples/services/wsdl_mode/xmime.xsd
==============================================================================
--- (empty file)
+++ trunk/wsf/php/src/tests/samples/services/wsdl_mode/xmime.xsd	Wed Apr 30 00:57:43 \
2008 @@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License. You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied. See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+	xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
+	targetNamespace="http://www.w3.org/2005/05/xmlmime">
+	<xs:attribute name="contentType">
+		<xs:simpleType>
+			<xs:restriction base="xs:string">
+				<xs:minLength value="3" />
+			</xs:restriction>
+		</xs:simpleType>
+	</xs:attribute>
+	<xs:attribute name="expectedContentTypes" type="xs:string" />
+	<xs:complexType name="base64Binary">
+		<xs:simpleContent>
+			<xs:extension base="xs:base64Binary">
+				<xs:attribute ref="xmime:contentType" />
+			</xs:extension>
+		</xs:simpleContent>
+	</xs:complexType>
+	<xs:complexType name="hexBinary">
+		<xs:simpleContent>
+			<xs:extension base="xs:hexBinary">
+				<xs:attribute ref="xmime:contentType" />
+			</xs:extension>
+		</xs:simpleContent>
+	</xs:complexType>
+</xs:schema>

_______________________________________________
Wsf-c-commits mailing list
Wsf-c-commits@wso2.org
http://www.wso2.org/cgi-bin/mailman/listinfo/wsf-c-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic