mtom return always attachment witi content-type = "image/png" - java-metro-framework

In my example of soap mtom optimization I've realized an project on Tomcat 7, metro (glassfish) in which I've got:
XSD
<xs:element name="retrievePicture" type="tns:retrievePicture"/>
<xs:complexType name="retrievePicture">
<xs:sequence>
<xs:element name="inImageNumber" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:element name="retrievePictureResponse" type="tns:JPEGPictureType"/>
<xs:simpleType name="JPEGPictureType"
xmime:expectedContentTypes="image/jpeg">
<xs:restriction base="xs:base64Binary" />
</xs:simpleType>
WSDL
<definitions ... >
<wsp:Policy
wsu:Id="PictureManagerPortBinding_MTOM_Policy-PictureManagerPortBinding_MTOM_Policy">
<ns1:OptimizedMimeSerialization
xmlns:ns1="http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization"
wsp:Optional="true" />
</wsp:Policy>
<types>
<xsd:schema>
<xsd:import namespace="http://service.ivan.com/" schemaLocation="PictureManagerService_schema1.xsd"/>
</xsd:schema>
</types>
<message name="retrievePicture">
<part name="parameters" element="tns:retrievePicture" />
</message>
<message name="retrievePictureResponse">
<part name="parameters" element="tns:retrievePictureResponse" />
</message>
<portType name="PictureManager">
<operation name="retrievePicture">
<input
wsam:Action="http://service.ivan.com/PictureManager/retrievePictureRequest"
message="tns:retrievePicture" />
<output
wsam:Action="http://service.ivan.com/PictureManager/retrievePictureResponse"
message="tns:retrievePictureResponse" />
</operation>
</portType>
<binding name="PictureManagerPortBinding" type="tns:PictureManager">
<wsp:PolicyReference
URI="#PictureManagerPortBinding_MTOM_Policy-PictureManagerPortBinding_MTOM_Policy" />
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<operation name="retrievePicture">
...
</operation>
</binding>
<service name="PictureManagerService">
...
</service>
</definitions>
SEI
#WebService(wsdlLocation="WEB-INF/wsdl/PictureManagerService.wsdl")
#MTOM
public class PictureManager {
....
#WebMethod(operationName = "retrievePicture")
public Image retrievePicture(
#WebParam(name = "inImageNumber") final int inImageNumber) {
java.awt.Image theImage = null;
//logic for return Image according request
return theImage;
}
}
My project consist of download JPEG image according of request.
In Soapui I get the following raw response:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: multipart/related; start="<rootpart*c069e1e8-2a0a-4ef7-8270-19bda938c27d#example.jaxws.sun.com>"; type="application/xop+xml"; boundary="uuid:c069e1e8-2a0a-4ef7-8270-19bda938c27d"; start-info="text/xml"
Transfer-Encoding: chunked
Date: Wed, 03 Jun 2015 08:03:55 GMT
--uuid:c069e1e8-2a0a-4ef7-8270-19bda938c27d
Content-Id: <rootpart*c069e1e8-2a0a-4ef7-8270-19bda938c27d#example.jaxws.sun.com>
Content-Type: application/xop+xml;charset=UTF-8;type="text/xml"
Content-Transfer-Encoding: binary
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:retrievePictureResponse xmlns:ns2="http://service.ivan.com/"><return><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:deba19db-0a7f-4367-82c3-b466e22f31fd#example.jaxws.sun.com"/></return></ns2:retrievePictureResponse></S:Body></S:Envelope>
--uuid:c069e1e8-2a0a-4ef7-8270-19bda938c27d
Content-Id: <deba19db-0a7f-4367-82c3-b466e22f31fd#example.jaxws.sun.com>
Content-Type: image/png
Content-Transfer-Encoding: binary
The problem is that the content type "image/png" is wrong as I would have expected "image/jpeg"

As i just had a similar issue, I don't think that this snippet will generate a DataHandler:
<xs:simpleType name="JPEGPictureType"
xmime:expectedContentTypes="image/jpeg">
<xs:restriction base="xs:base64Binary" />
</xs:simpleType>
I'am still trying to find out why, but meanwhile you can do the same as me and I think that will help you too. Just use directly the element retrievePictureResponse instead of working with xs:simpleType, so you can use this code :
<xs:element name="retrievePictureResponse" type="xs:base64Binary"
xmime:expectedContentTypes="image/jpeg" />

Related

OSB 12C REST adapter has blank fields

I am invoking a business service from OSB 12C that accepts POST methods. I added a REST adapter in the business column after making the request and response XSD's. In the pipeline, I use an XQuery file for transformation of the proxy service's request body to the business service's body.
Examining the receiving app as well as the network traffic, I see that the request is being submitted with a Content-Type: application/x-www-form-urlencoded header, but the payload is completely blank.
As a test, I changed the method to GET. This places the form fields within the URL, so the transformation, etc. is correct. It just doesn't work in the POST method. I've been stuck for a week on this.
Here's the XSD for the business request:
<?xml version = '1.0' encoding = 'UTF-8'?>
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
xmlns:tns="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request"
targetNamespace="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request"
elementFormDefault="qualified" attributeFormDefault="unqualified" nxsd:encoding="US-ASCII">
<xsd:element name="GetPendingRequests-BusinessRequest-Root-Element">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="db" type="xsd:string"/>
<xsd:element name="fromDate" type="xsd:string"/>
<xsd:element name="max" type="xsd:integer"/>
<xsd:element name="page" type="xsd:integer"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:annotation>
<xsd:appinfo>NXSDSAMPLE=</xsd:appinfo>
<xsd:appinfo>USEHEADER=false</xsd:appinfo>
</xsd:annotation>
</xsd:schema>
And the XQuery file:
xquery version "1.0" encoding "utf-8";
(:: OracleAnnotationVersion "1.0" ::)
declare namespace smar="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request";
(:: import schema at "GetPendingRequestsBusinessRequest.xsd" ::)
declare variable $db as xs:string external;
declare variable $fromDate as xs:string external;
declare variable $max as xs:integer external;
declare variable $page as xs:integer external;
declare function local:func($db as xs:string, $fromDate as xs:string, $max as xs:integer, $page as xs:integer) as element()
(:: schema-element(smar:GetPendingRequests-BusinessRequest-Root-Element) ::) {
<smar:GetPendingRequests-BusinessRequest-Root-Element
xmlns:smar="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request">
<smar:db>{fn:data($db)}</smar:db>
<smar:fromDate>{fn:data($fromDate)}</smar:fromDate>
<smar:max>{fn:data($max)}</smar:max>
<smar:page>{fn:data($page)}</smar:page>
</smar:GetPendingRequests-BusinessRequest-Root-Element>
};
local:func($db, $fromDate, $max, $page)
The WADL file:
<?xml version = '1.0' encoding = 'UTF-8'?>
<application xmlns:soa="http://www.oracle.com/soa/rest"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tns="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request"
xmlns="http://wadl.dev.java.net/2009/02">
<doc title="SmartCardBusinessServices">WADL Reference for REST calls for smart cards</doc>
<grammars>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request"
schemaLocation="../../GetPendingRequests/Business/GetPendingRequestsBusinessRequest.xsd"/>
</xsd:schema>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_response"
schemaLocation="../../GetPendingRequests/Business/GetPendingRequestsBusinessResponse.xsd"/>
</xsd:schema>
</grammars>
<resources>
<resource path="/getPendingRequests">
<method name="POST" soa:wsdlOperation="GetPendingRequests">
<request>
<representation mediaType="application/x-www-form-urlencoded"
element="cns:GetPendingRequests-BusinessRequest-Root-Element"
xmlns:cns="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request"/>
</request>
<response status="200">
<representation mediaType="application/json"
element="cns:GetPendingRequests-BusinessResponse-Root-Element"
xmlns:cns="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_response"/>
</response>
</method>
</resource>
</resources>
</application>
Lastly, the WSDL:
<?xml version= '1.0' encoding= 'UTF-8' ?>
<wsdl:definitions
name="SmartCardBusinessServices"
targetNamespace="http://xmlns.oracle.com/ServiceBusApplication1/MVRServices/SmartCardBusinessServices"
xmlns:tns="http://xmlns.oracle.com/ServiceBusApplication1/MVRServices/SmartCardBusinessServices"
xmlns:inp1="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request"
xmlns:inp2="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_response"
xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>
<plnk:partnerLinkType name="SmartCardBusinessServices">
<plnk:role name="SmartCardBusinessServicesProvider" portType="tns:SmartCardBusinessServices_ptt"/>
</plnk:partnerLinkType>
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_request"
schemaLocation="../../GetPendingRequests/Business/GetPendingRequestsBusinessRequest.xsd"/>
</xsd:schema>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://TargetNamespace.com/SmartCardBusiness_GetPendingRequests_response"
schemaLocation="../../GetPendingRequests/Business/GetPendingRequestsBusinessResponse.xsd"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="GetPendingRequests_inputMessage">
<wsdl:part name="request" element="inp1:GetPendingRequests-BusinessRequest-Root-Element"/>
</wsdl:message>
<wsdl:message name="GetPendingRequests_outputMessage">
<wsdl:part name="reply" element="inp2:GetPendingRequests-BusinessResponse-Root-Element"/>
</wsdl:message>
<wsdl:portType name="SmartCardBusinessServices_ptt">
<wsdl:operation name="GetPendingRequests">
<wsdl:input message="tns:GetPendingRequests_inputMessage"/>
<wsdl:output message="tns:GetPendingRequests_outputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SmartCardBusinessServices_ptt-binding" type="tns:SmartCardBusinessServices_ptt">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetPendingRequests">
<soap:operation soapAction="GetPendingRequests"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
</wsdl:definitions>

Converting an old JAX RPC WSDL file to a JAX WS WSDL file

I was wondering if is there some way to convert an old RPC WSDL file to a JAX-WS WSDL file. Tried my best to make sure I did my homework but I'm kind of lost here.
From what I've read, I should remove all the 'encodingstyle' ocurrences and switch use="encoded" to use="literal". I can't run any tests by now since the service is currently unavailable. Does anyone know if that should be enough? Any insight will be extremely appreciated.
This is my WSDL file:
<?xml version="1.0" encoding="iso-8859-1"?>
<definitions 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/" xmlns:tns="urn:wsScrc.XML" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:wsScrc.XML">
<types>
<xsd:schema targetNamespace="urn:wsScrc.XML">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
</xsd:schema>
</types>
<message name="XMLRequest">
<part name="parmA" type="xsd:string" />
<part name="parmB" type="xsd:string" />
<part name="parmC" type="xsd:string" />
<part name="parmD" type="xsd:string" />
<part name="parmE" type="xsd:string" />
<part name="parmF" type="xsd:string" />
<part name="parmG" type="xsd:string" />
</message>
<message name="XMLResponse">
<part name="respA" type="xsd:string" />
<part name="respB" type="xsd:string" />
<part name="respC" type="xsd:string" />
<part name="respD" type="xsd:string" />
<part name="respE" type="xsd:string" />
</message>
<message name="monitorRequest"></message>
<message name="monitorResponse">
<part name="ipServidor" type="xsd:string" />
</message>
<portType name="wsScrc.XMLPortType">
<operation name="XML">
<documentation>Retorna o xml</documentation>
<input message="tns:XMLRequest"/>
<output message="tns:XMLResponse"/>
</operation>
<operation name="monitor">
<documentation>Retorna uma mensagem de ok</documentation>
<input message="tns:monitorRequest"/>
<output message="tns:monitorResponse"/>
</operation>
</portType>
<binding name="wsScrc.XMLBinding" type="tns:wsScrc.XMLPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="XML">
<soap:operation soapAction="urn:wsScrc.XML#XML" style="rpc"/>
<input>
<soap:body use="encoded" namespace="urn:wsScrc.XML" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:wsScrc.XML" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="monitor">
<soap:operation soapAction="urn:wsScrc.monitor#monitor" style="rpc"/>
<input>
<soap:body use="encoded" namespace="urn:wsScrc.monitor" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:wsScrc.monitor" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="wsScrc.XML">
<port name="wsScrc.XMLPort" binding="tns:wsScrc.XMLBinding">
<soap:address location="http://thisismyaddress/webservicePHP/ws.php"/>
</port>
</service>
</definitions>
Thanks in advance.
We were able to do the same by altering the WSDL in that way.
The only issue is that we had to use SAAJ in order to generate the right request and to process the response.
In another WS we used it was just not possible because the XML in the body is generated by Castor. Finally we did not succeed as we did not know what the server expect.
In conclusion I would say: it depends how the server was implemented.

WSDL with soap-rpc-style does not compile

I'm using this wsdl-file to describe my webservice:
<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions targetNamespace="http://www.myapproach.de/knowledgebase" name="Knowledgebase"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:tns="http://www.myapproach.de/knowledgebase"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:rq="http://www.myapproach.de/knowledgebase">
<wsdl:types>
<xsd:schema>
<xsd:import namespace="http://www.myapproach.de/knowledgebase" schemaLocation="GetValueRequest.xsd"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="getValueForKey">
<wsdl:part name="parameters" element="rq:getValueForKey" />
</wsdl:message>
<wsdl:message name="getValueForKeyResponse">
<wsdl:part name="parameters" element="rq:getValueForKeyResponse" />
</wsdl:message>
<wsdl:portType name="KnowledgebasePortType">
<wsdl:operation name="getValueForKey">
<wsdl:input message="tns:getValueForKey" />
<wsdl:output message="tns:getValueForKeyResponse" />
</wsdl:operation>
</wsdl:portType>
<wsp:Policy wsu:Id="KnowledgebasePortBinding_WSAM_Addressing_Policy">
<wsam:Addressing wsp:Optional="true">
<wsp:Policy />
</wsam:Addressing>
</wsp:Policy>
<wsdl:binding name="KnowledgebasePortBinding" type="tns:KnowledgebasePortType">
<wsaw:UsingAddressing />
<wsp:PolicyReference URI="#KnowledgebasePortBinding_WSAM_Addressing_Policy" />
<!-- http://www.w3.org/2003/05/soap/bindings/HTTP/ -->
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />
<wsdl:operation name="getValueForKey">
<soap:operation soapAction="http://www.myapproach.de/knowledgebase/getValueForKey" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Knowledgebase">
<wsdl:port name="KnowledgebasePortType" binding="tns:KnowledgebasePortBinding">
<soap:address location="http://www.myapproach.de/knowledgebase" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
GetValueRequest.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.myapproach.de/knowledgebase" xmlns:tns="http://www.myapproach.de/knowledgebase">
<xsd:element name="getValueForKey" type="tns:getValueForKey" />
<xsd:complexType name="getValueForKey">
<xsd:sequence>
<xsd:element name="arg0" type="xsd:string" minOccurs="0" />
<xsd:element name="arg1" type="xsd:string" minOccurs="0" />
<xsd:element name="arg2" type="xsd:double"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="getValueForKeyResponse" type="tns:getValueForKeyResponse" />
<xsd:complexType name="getValueForKeyResponse">
<xsd:sequence>
<xsd:element name="return" type="xsd:string" minOccurs="0" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
Everytime I run wsimport, I get this error:
[wsimport] parsing WSDL...
[wsimport] [ERROR] Invalid wsdl:operation "getValueForKey": its a rpc-literal operation, message part must refer to a schema type declaration
[wsimport] line 27 of file:/path/MyFile.wsdl
I have exported the getValueForKey type to the xsd-schemafile, so I don't understand this error... I'm trying this sh*** the whole day grml
Shortly after posting the question I found the answer :-)
Instead of
<wsdl:message name="getValueForKey">
<wsdl:part name="parameters" element="rq:getValueForKey" />
</wsdl:message>
use this
<wsdl:message name="getValueForKey">
<wsdl:part name="parameters" type="rq:getValueForKey" />
</wsdl:message>
the attribute "type" must be used instead of "element".
Additionally the soap:body element has to have a namespace
<wsdl:input>
<soap:body use="literal" namespace="YourNormalNamespace" />
</wsdl:input>
In short, wsdl part has to have type in case of RPC style of webservices else it has to be document style.

WSDL list of complexType HOWTO- define, return from a service?

How do you define a list of complex type items in WSDL?
I have a rather simple WSDL with 2 complex types
<xsd:complexType name="itemProperty">
<xsd:all>
<xsd:element name="name" type="xsd:string" />
<xsd:element name="value" type="xsd:string" />
<xsd:element name="type" type="xsd:string" />
</xsd:all>
</xsd:complexType>
Then i'm trying to make a list of this complexType like this:
<xsd:complexType name="itemPropertyList">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:sequence>
<xsd:element name="item" type="tns:itemProperty"
maxOccurs="unbounded" minOccurs="0" />
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
I intend to use this list
<message name="getListRequest"></message>
<message name="getListResponse">
<part name="return" type="tns:itemPropertyList" />
</message>
<operation name="getList">
<documentation>Returns an array.</documentation>
<input message="tns:getListRequest" />
<output message="tns:getListResponse" />
</operation>
Instead of a list of elements of type itemProperty, I get this reply, no matter what variations i've tryed (including replacing the base item with the explicit string elements)
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:getListResponse>
<return SOAP-ENC:arrayType="ns2:Map[1]" xsi:type="SOAP-ENC:Array">
<item xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">name</key>
<value xsi:type="xsd:string">name_4c3b38b0b77ae</value>
</item>
<item>
<key xsi:type="xsd:string">value</key>
<value xsi:type="xsd:string">name_4c3b38b0b77ee</value>
</item>
<item>
<key xsi:type="xsd:string">type</key>
<value xsi:type="xsd:string">name_4c3b38b0b782b</value>
</item>
</item>
</return>
</ns1:getListResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Any ideas? What is this ns2:Map thing? It's been haunting me for over a week!
Solved.
I used the AXIS model for delivering lists. This involved extending the namespaces attributes to include some extra encodings. I don't know which did the trick, I just added as many as possible while resolving conflicts with the help of eclipse's WSDL editor.
<definitions 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:tns="urn:mynamespace"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="urn:mynamespace"
xmlns:ns1="http://org.apache.axis2/xsd"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:ax21="http://example.org/xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
Also I added 2 extra attributes to declare qualified-form attributes and elements within the schema
<xsd:schema targetNamespace="urn:mynamespace" attributeFormDefault="qualified" elementFormDefault="qualified">
...
</xsd:schema>
Instead of relying on the ComplexType declaration to make a "nillable" unbounded sequence of a complex type within my schema, I switched to declare an element like this:
<xsd:element name="getListResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="tns:itemProperty" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Then, when defining the message part for the operation I used
<message name="getListResponse">
<part name="parameters" element="tns:getListResponse" />
</message>
instead of
<message name="getListResponse">
<part name="return" type="tns:itemPropertyList" />
</message>
This resulted in a correct enveloper returned:
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:mynamespace" 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>
<ns1:getListResponse>
<parameters xsi:type="ns1:getListResponse">
<return xsi:type="ns1:itemProperty">
<name xsi:type="xsd:string">name4c4417b644a8e</name>
<value xsi:type="xsd:string">value4c4417b644aaa</value>
<type xsi:type="xsd:string">type4c4417b644ae8</type>
</return>
<return xsi:type="ns1:itemProperty">
<name xsi:type="xsd:string">name4c4417b644b26</name>
<value xsi:type="xsd:string">value4c4417b644b64</value>
<type xsi:type="xsd:string">type4c4417b644ba1</type>
</return>
<return xsi:type="ns1:itemProperty">
<name xsi:type="xsd:string">name4c4417b644bdf</name>
<value xsi:type="xsd:string">value4c4417b644c1c</value>
<type xsi:type="xsd:string">type4c4417b644c59</type>
</return>
</parameters>
</ns1:getListResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

How to manage resources in an F# project?

Can I use .resx files in F# 2.0 projects?
If so, how do I go about adding, and then using these resources.
Thanks in advance.
You can Add existing item a .resx file to an F# project, it should automatically get a BuildAction of EmbeddedResource and work. The VS tooling here isn't as good as the other languages yet, but MSBuild does all the heavy lifting, so it's just a matter of getting the right snippet of XML into the .fsproj file.
I'm using a .resx in an F# 2.0 project. Feel free to take a look at it and I hope it helps you. No great shakes but here it is for what it's worth.
http://github.com/OnorioCatenacci/ExtendedSearch
EDIT: For what it's worth, here's the relevant portion of the fsproj file
<ItemGroup>
<Compile Include="assemblyinfo.ExtendedSearch.exe.fs" />
<Compile Include="ExtendedSearch.fs" />
<EmbeddedResource Include="ExtendedSearch.resx" />
</ItemGroup>
And here's ExtendedSearch.resx:
<?xml version="1.0" encoding="utf-8"?>
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, ...</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, ...</value>
</resheader>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<data name = "AppDisplayName">
<value>Extended Search</value>
</data>
<data name="FilePathSpecLabel">
<value>Base File Path:</value>
</data>
<data name="FilePathSpecDefault">
<value>C:\</value>
</data>
<data name ="SelectDirButtonLabel">
<value>. . .</value>
</data>
<data name="FileNameSpecLabel">
<value>File Name Spec:</value>
</data>
<data name="FileNameSpecDefault">
<value>*.dll</value>
</data>
<data name="RecurseIntoSubdirsLabel">
<value>Recurse Into Subdirectories</value>
</data>
<data name ="MajorVerDefault">
<value>1</value>
</data>
<data name="MinorVerDefault">
<value>0</value>
</data>
<data name="RevisionVerDefault">
<value>0</value>
</data>
<data name="BuildVerDefault">
<value>0</value>
</data>
<data name="VersionLabel">
<value>File &Version:</value>
</data>
<data name="SearchButtonCaption">
<value>&Search</value>
</data>
<data name="CancelButtonCaption">
<value>&Cancel</value>
</data>
</root>
I hope this removes any future issues with people not being able to find this on GitHub.
Here is another way. Though I know it's too late for the original question, I hope it helps others.
Create a clean text file with a name=value format, one key/value pair per line. In a file named "strings.txt", write
name1=hello
name2=world
Create a resource file using ResGen.exe acting on your text file from Step 1. You can learn about ResGen at http://msdn.microsoft.com/en-us/library/ccec7sz1%28v=vs.80%29.aspx. ResGen will create a CLR binary file named "strings.resources". Put this resource file where your compiler can find it.
Add "--resource:strings.resources" as a compiler option. I did this from the "Other flags" textbox in the Build properties. You can find more info at http://msdn.microsoft.com/en-us/library/dd233171.aspx
Write the following in your F# project
open System.Resources
let res = ResourceManager("strings", System.Reflection.Assembly.GetExecutingAssembly())
res.GetString("name1") + res.GetString("name2") |> printfn "%s"
To add a resource to an existing F# project, per #"Onorio Catenacci" GitHub Linke above...
Create a text file and fill it with the content below then save and close it.
Rename this text file extension to .resx (XML resource file)
Update the Build Action to EmbeddedResource
The file should now open correctly in the VS resource editor allowing you to edit it's contents.
.resx file template:
<root>
<resheader name="resmimetype"><value>text/microsoft-resx</value></resheader>
<resheader name="version"><value>2.0</value></resheader>
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, ...</value></resheader>
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, ...</value></resheader>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</root>

Resources