JiBX unmarshalling exception in spring ws - spring-ws

I am new to Spring WS and JiBX. I have not used annotations. I am getting the following error while using Jibx in Spring WS.
JiBX unmarshalling exception: No unmarshaller for element "{http://www.visu.com/pos/soapws/}orderRequest" (line 1, col 103); nested exception is org.jibx.runtime.JiBXException: No unmarshaller for element "{http://www.visu.com/pos/soapws/}orderRequest"
Here is my Endpoint and the spring configuration
public class OrderEndPoint extends AbstractMarshallingPayloadEndpoint{
private Marshaller marshaller;
private Unmarshaller unmarshaller;
private OrderService orderService;
public OrderEndPoint(final OrderService orderService, final Marshaller marshaller, final Unmarshaller unmarshaller) {
super(marshaller);
super.setUnmarshaller(unmarshaller);
//this.marshaller = marshaller;
//this.unmarshaller = unmarshaller;
this.orderService = orderService;
System.out.println("This is Order End point constructor");
}
#Override
protected Object invokeInternal(final Object newOrder) throws Exception {
System.out.println("This is test for Invoke Internal");
final OrderRequest orderReq = (OrderRequest)newOrder;
final Order order = orderReq.getOrder();
this.orderService.placeOrder(order);
return "Order with the order number "+order.getOrderNumber()+" saved successfully";
}
}
<!-- Jibx marshellers -->
<bean id="unmarshaller" class="org.springframework.oxm.jibx.JibxMarshaller">
<property name="targetClass" value="com.visu.pos.soapws.model.OrderRequest"/>
<property name="bindingName" value="binding"/>
</bean>
<bean id="marshaller" class="org.springframework.oxm.jibx.JibxMarshaller">
<property name="targetClass" value="com.visu.pos.soapws.model.OrderResponse"/>
<property name="bindingName" value="binding"/>
</bean>
Below is the Order.xsd which is used for binding
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.visu.com/pos/soapws/" elementFormDefault="qualified" targetNamespace="http://www.visu.com/pos/soapws/">
<xs:element type="tns:orderRequest" name="orderRequest"/>
<xs:complexType name="orderRequest">
<xs:sequence>
<xs:element type="tns:order" name="order" minOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:element type="tns:order" name="order"/>
<xs:complexType name="order">
<xs:sequence>
<xs:element name="customer" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="firstName" minOccurs="0"/>
<xs:element type="xs:string" name="lastName" minOccurs="0"/>
<xs:element type="xs:string" name="middleName" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute type="xs:long" use="required" name="customerNumber"/>
</xs:complexType>
</xs:element>
<xs:element type="tns:address" name="billTo" minOccurs="0"/>
<xs:element name="shipping" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="STANDARD_MAIL"/>
<xs:enumeration value="PRIORITY_MAIL"/>
<xs:enumeration value="INTERNATIONAL_MAIL"/>
<xs:enumeration value="DOMESTIC_EXPRESS"/>
<xs:enumeration value="INTERNATIONAL_EXPRESS"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element type="tns:address" name="shipTo" minOccurs="0"/>
<xs:element name="item" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="id" minOccurs="0"/>
<xs:element type="xs:string" name="description" minOccurs="0"/>
</xs:sequence>
<xs:attribute type="xs:int" use="required" name="quantity"/>
<xs:attribute type="xs:float" use="required" name="price"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:long" use="required" name="orderNumber"/>
<xs:attribute type="xs:date" name="orderDate"/>
<xs:attribute type="xs:date" name="shipDate"/>
<xs:attribute type="xs:float" name="total"/>
</xs:complexType>
<xs:complexType name="address">
<xs:sequence>
<xs:element type="xs:string" name="street1" minOccurs="0"/>
<xs:element type="xs:string" name="street2" minOccurs="0"/>
<xs:element type="xs:string" name="city" minOccurs="0"/>
<xs:element type="xs:string" name="state" minOccurs="0"/>
<xs:element type="xs:string" name="postCode" minOccurs="0"/>
<xs:element type="xs:string" name="country" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="orderResponse">
<xs:sequence>
<xs:element type="xs:string" name="orderResponse" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:element type="tns:orderResponse" name="orderResponse"/>
</xs:schema>
Verified on the net that the Jibx implementation does not need Marshaller and Unmarshaller separately. Though I declared the marshaller it is throwing this error. I tried all options available but to no use. Please help in this regard. Thanks in advance!!

<bean id="orderEndPoint" class="OrderEndPoint">
<property name="marshaller" ref="marshaller" />
<property name="unmarshaller" ref="unmarshaller" />
<property name="orderService" ref="orderService" />
</bean>
Please set the properties while creating the OrderEndPoint bean
construtor injection not needed.Just create setter and getter in OrderEndPoint for orderService.
Note: OrderRequest should be the marshaller. (you have configures as unmarshaller)

Related

Pass complex type parameter as object in Savon

I want to pass the object as a parameter in Savon call. I am passing hash with type as follows
require 'savon'
class Test
def operation
client = Savon.client(wsdl:'Web service wsdl link for eg http://google.com?wsdl')
//in this case p_request is the name of TestMessage type which i got while reading from wsdl
data = { 'p_request' => { 'Request' => 'Test',
'Result' => 'empty'} }
response = client.call(:ping1, message: data)
but I am getting NULL response. How to pass of Complex type in Savon call?
Any help is appreciated.
Please find WSDL
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<xs:import namespace="http://schemas.datacontract.org/2004/07/Xipaysandbox"/>
<xs:element name="Ping1">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:q1="http://schemas.datacontract.org/2004/07/Xipaysandbox" minOccurs="0" name="p_request" nillable="true" type="q1:TestMessage"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.datacontract.org/2004/07/Xipaysandbox" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/Xipaysandbox">
<xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xs:complexType name="TestMessage">
<xs:sequence>
<xs:element minOccurs="0" name="Request" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="Result" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="TestMessage" nillable="true" type="tns:TestMessage"/>
</xs:schema>
</wsdl:types>

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

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" />

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 Definition Problem

We have been given a .wsdl file (listing below) which we will be using to generate c# code for use in our app. When I load the file into xmlspy I get the following error
attribute 'type' in message part 'organisation' (message 'getOrganisationResponse') refers to type 'organisation' which is not defined within the WSDL file!
It says it can't find the type but this is defined in the section at the top of the file, so I'm not sure why it does not find it.
Any help would be appreciated
Cheers
Richard
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns:tns="http://www.xxxx.com/epp/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:ns1="http://xml.apache.org/xml-soap/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
name="Heiq"
targetNamespace="http://www.xxxx.com/epp/">
<types>
<!-- Organisation object -->
<xsd:element name="organisation">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="id" type="xsd:string" minOccurs="0"/>
<xsd:element name="componentID" type="xsd:string" minOccurs="0"/>
<xsd:element name="name" type="xsd:string" minOccurs="0"/>
<xsd:element name="suburb" type="xsd:string" minOccurs="0"/>
<xsd:element name="address1" type="xsd:string" minOccurs="0"/>
<xsd:element name="address2" type="xsd:string" minOccurs="0"/>
<xsd:element name="postcode" type="xsd:string"/>
<xsd:element name="phone" type="xsd:string"/>
<xsd:element name="fax" type="xsd:string"/>
<xsd:element name="emailAddress" type="xsd:string"/>
<xsd:element name="website" type="xsd:string"/>
<xsd:element name="contactPersonName" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</types>
<message name="getOrganisationRequest">
<part name="token" type="xsd:string"/>
<part name="organisationID" type="xsd:string"/>
</message>
<message name="getOrganisationResponse">
<part name="organisation" type="organisation"/>
</message>
<portType name="xxxxPortType">
<!-- Get organisation function -->
<operation name="getOrganisation">
<input message="tns:getOrganisationRequest"/>
<output message="tns:getOrganisationResponse"/>
</operation>
</portType>
<binding name="xxxxBinding" type="tns:xxxxPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<!-- Get organisation function -->
<operation name="getOrganisation">
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="xxxxService">
<port name="xxxxPort" binding="tns:xxxxBinding">
<soap:address location="http://www.xxxx.com/xxxx/application/soap.php"/>
</port>
</service>
</definitions>
Your type declarations underneath <types> need to be given their own namespace. I'm guessing that the supplier of your wsdl either used an extremely lax parser when testing the WSDL they wrote or relied on some code first WSDL generation tool to create this WSDL. In either case, the onus is on them to get you a properly conforming WSDL and xsd.
Here is an example of what the relevant parts of that WSDL should look like - change the namespaces here as you wish:
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns:tns="http://www.xxxx.com/epp/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:ns1="http://xml.apache.org/xml-soap/"
xmlns:types="http://www.xxxx.com/types/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
name="Heiq"
targetNamespace="http://www.xxxx.com/epp/">
<types>
<xsd:schema targetNamespace="http://www.xxxx.com/types/"
xmlns="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="organisation">
<xsd:sequence>
<xsd:element name="id" type="xsd:string" minOccurs="0"/>
<xsd:element name="componentID" type="xsd:string" minOccurs="0"/>
<xsd:element name="name" type="xsd:string" minOccurs="0"/>
<xsd:element name="suburb" type="xsd:string" minOccurs="0"/>
<xsd:element name="address1" type="xsd:string" minOccurs="0"/>
<xsd:element name="address2" type="xsd:string" minOccurs="0"/>
<xsd:element name="postcode" type="xsd:string"/>
<xsd:element name="phone" type="xsd:string"/>
<xsd:element name="fax" type="xsd:string"/>
<xsd:element name="emailAddress" type="xsd:string"/>
<xsd:element name="website" type="xsd:string"/>
<xsd:element name="contactPersonName" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</types>
<message name="getOrganisationRequest">
<part name="token" type="xsd:string"/>
<part name="organisationID" type="xsd:string"/>
</message>
<message name="getOrganisationResponse">
<part name="organisation" type="types:organisation"/>
</message>
...

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