odatagen: Failed to generate proxy classes. Please verify the metadata (iOS) - iphone

Im working on Open Data Protocol (OData) which is a standardized protocol for creating and consuming data API's.
OData builds on core protocols like HTTP and commonly accepted methodologies like REST .
I have installed, configured and built OData successfully on iOS6
Currently I'm creating a Proxy class to connect to the OData Service using the following commands:
cd /Users/Shamsu/Applications/ODataObjC/ODataSDKV1-1.3/Framework/bin/ODatagenBinary/MacOSX10.7.sdk/Debug
./odatagen /uri=http://35.35.6.4/MyApp.MyApp3D.DataService/MyApp3DDataService.svc/ /out=/Users/Ramshad/Applications/ODataObjC/ODataSDKV1-1.3/Framework/bin/ODatagenBinary/MacOSX10.7.sdk/Debug /u=sa /p=123
However, I'm getting the error: "odatagen: Failed to generate proxy classes. Please verify the metadata"
I can see the "metadata.xml" file is updated as
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
<edmx:DataServices m:DataServiceVersion="1.0" m:MaxDataServiceVersion="3.0" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<Schema Namespace="MyAppDBModel" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityType Name="User">
<Key>
<PropertyRef Name="UserID" />
</Key>
<Property Name="UserID" Type="Edm.Guid" Nullable="false" />
<Property Name="UserName" Type="Edm.String" MaxLength="10" FixedLength="true" Unicode="true" />
<Property Name="UserDescription" Type="Edm.String" MaxLength="50" FixedLength="false" Unicode="true" />
<Property Name="Active" Type="Edm.Int64" />
</EntityType>
</Schema>
<Schema Namespace="MyApp.MyApp3D.DataService" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityContainer Name="MyAppDBEntities" m:IsDefaultEntityContainer="true" p6:LazyLoadingEnabled="true" xmlns:p6="http://schemas.microsoft.com/ado/2009/02/edm/annotation">
<EntitySet Name="User" EntityType="MyAppDBModel.User" />
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx> "
Note: the metadata.xml file is located at out param location (/Users/Ramshad/Applications/ODataObjC/ODataSDKV11.3/Framework/bin/ODatagenBinary/MacOSX10.7.sdk/Debug /metadata.xml)
I'm unable to identify the issue. Any problem with my windows WCF service /ODataService configuration/database configuration ? Permission assigned as * (read,write).
Any help on this issue is appreciated.
Thanks.

I looked a bit closer at the XSLT document I linked to in my original comment, and it seems that the odatagen tool hasn't been updated to work with CSDL v3. The version of CSDL (i.e., the format used to serialize the metadata document) is indicated by the xml namespace of the Schema element. In your metadata, that namespace is http://schemas.microsoft.com/ado/2009/11/edm, which indicates CSDL v3. You can see in the XSLT document here that this namespace isn't recognized by the odatagen tool.
Since the odatagen tool is open source (see the source on github), you can try to tweak the code and XSLT files to make it work for your situation. You could try to just add the v3 namespace to the recognized schema namespaces, and if your metadata doesn't use any v3 features, I would imagine it would just work. Off the top of my head I'm not sure of the exact differences between v2 and v3, so I can't immediately say whether the metadata you've posted above would be valid in CSDL v2.
Alternatively, you could try to generate the $metadata document so that it's using CSDL v2 instead.
Sorry I don't have a better answer for you. Unfortunately, the odatagen tool has fallen a bit behind. But you're more than welcome to contribute to the project :)

Related

jaysvcutil failing with TypeError: Cannot read property 'schemas' of undefined

I am trying to generate the model from an existing OData service through jaysvcutil and am getting:
[...]\node_modules\jaydata-odatajs\lib\odata\odatautils.js:385
throw err;
^
TypeError: Cannot read property 'schemas' of undefined
at Metadata.processMetadata ([...]\node_modules\jaydata-dynamic-metadata\lib\metadata.js:353:35)
at requestData ([...]\node_modules\jaydata-dynamic-metadata\lib\metadataHandler.js:46:42)
at [...]\node_modules\jaydata-odatajs\lib\odata\odatautils.js:382:13
at IncomingMessage.<anonymous> ([...]\node_modules\jaydata-odatajs\lib\odata\net.js:179:21)
at emitNone (events.js:72:20)
at IncomingMessage.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:921:12)
at nextTickCallbackWith2Args (node.js:442:9)
at process._tickCallback (node.js:356:17)
I tried to condense the domain model into something really simple, so my current $metadata looks like this:
<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" Version="1.0">
<edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="1.0">
<Schema xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://schemas.microsoft.com/ado/2007/05/edm" Namespace="data">
<EntityType Name="Product">
<Key>
<PropertyRef Name="ProductId"/>
</Key>
<Property Name="ProductId" Type="Edm.Int64" Nullable="false"/>
<Property Name="ProductNo" Type="Edm.String" Nullable="true"/>
<Property Name="LifeTime" Type="Edm.Int64" Nullable="false"/>
<Property Name="Capacity" Type="Edm.Int64" Nullable="false"/>
<Property Name="PackingSize" Type="Edm.Int64" Nullable="false"/>
<Property Name="CreationTime" Type="Edm.DateTime" Nullable="false"/>
<Property Name="ModificationTime" Type="Edm.DateTime" Nullable="false"/>
</EntityType>
</Schema>
<Schema xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://schemas.microsoft.com/ado/2007/05/edm" Namespace="Namespace">
<EntityContainer Name="DomainData" m:IsDefaultEntityContainer="true">
<EntitySet Name="Product" EntityType="data.Product"/>
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
This is an existing WCF DataService based OData provider using OData V1 and I am not able to change that - so please do not recommend updating the provider to V4.
Any help would be appreciated.
As per feedback from the JayData team:
JayData supports OData v4, as there have been multiple breaking changes in both OData and DataJS since v1.
and also
JayData 1.3.7 supports v2 and v3, but it does not support TypeScript and Angular 2.
I will therefore be looking at alternatives, presumably breezejs.

How do I convince the Visual Studio Publish Web wizard that my database is Entity Framework CodeFirst?

In VS2015 when I open an existing publish profile in the publish wizard, it immediately decides that my default database is no longer EF CodeFirst and removes the option to Execute Code First Migrations and replaces it with Update Database.
Somehow, the wizard seems to be deciding that this is no longer a CodeFirst Project and is replacing it with DbDacFx like so:
<PublishDatabaseSettings>
<Objects xmlns="">
<ObjectGroup Name="DefaultConnection" Order="1" Enabled="True">
<Destination Path="Data Source=*" />
<Object Type="DbCodeFirst">
<Source Path="DBMigration" DbContext="m4d.Context.DanceMusicContext, m4d" MigrationConfiguration="m4d.Migrations.Configuration, m4d" Origin="Configuration" />
</Object>
</ObjectGroup>
</Objects>
</PublishDatabaseSettings>
Transforms to:
<PublishDatabaseSettings>
<Objects xmlns="">
<ObjectGroup Name="DefaultConnection" Order="1" Enabled="False">
<Destination Path="Data Source=*" />
<Object Type="DbDacFx">
<PreSource Path="Data Source=*" includeData="False" />
<Source Path="$(IntermediateOutputPath)AutoScripts\DefaultConnection_IncrementalSchemaOnly.dacpac" dacpacAction="Deploy" />
</Object>
<UpdateFrom Type="Web.Config">
<Source MatchValue="Data Source=*" MatchAttributes="$(UpdateFromConnectionStringAttributes)" />
</UpdateFrom>
</ObjectGroup>
</Objects>
</PublishDatabaseSettings>
(I replaced the various connection strings with *)
Anyone have any idea what the wizard uses to decide that this is a CodeFirst Project?
This article http://blogs.msdn.com/b/webdev/archive/2014/04/09/ef-code-first-migrations-deployment-to-an-azure-cloud-service.aspx provides some details of how to roll one's own version of the Execute Code First Migrations option, and is a potential workaround, but it used to just work.
In your .pubxml file, you must rename the ObjectGroup as the full name of your Dbcontext: m4d.Migrations.Configuration. Otherwise, it seems to be ignored.
<PublishDatabaseSettings>
<Objects xmlns="">
<ObjectGroup Name="m4d.Migrations.Configuration" Order="1" Enabled="True">
<Destination Path="Data Source=*" />
<Object Type="DbCodeFirst">
<Source Path="DBMigration" DbContext="m4d.Context.DanceMusicContext, m4d" MigrationConfiguration="m4d.Migrations.Configuration, m4d" Origin="Configuration" />
</Object>
</ObjectGroup>
</Objects>
</PublishDatabaseSettings>

Different SOAP namespaces in different environments

I wrote a client (Java) to a web service requiring WS Security headers. I used cxf to generate my sources from the WSDL. When I run my client on Tomcat, it works fine, however, when I move it to Websphere, I get a fault back from the service saying the signature is invalid. I compared the generated soap envelopes and all of the tags match between the two and the key values are the same. The only difference is that WAS has added the namespaces for soapenc, xsi and xsd. These prefixes then get added to the IncludedNamespaces of the canonicalized method. And from what I've read, can get in the mix of the signature. I can't tell if Websphere is adding these or if it is perhaps a different version of a class being picked up. Either way, the webservice will not accept it with these namespaces. Can these be removed?
WebSphere namespace inclusion
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
Websphere canonicalized tags
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
<ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="soapenc xsd xsi" />
</ds:Transform>
</ds:Transforms>
Tomcat namespace inclusion
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
Tomcat canonicalized tags
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
<ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="wsse soap" />
</ds:Transform>
</ds:Transforms>
Here is my WSS4jOutInterceptor Spring Config (some data removed)
<bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor"
id="outbound-security">
<constructor-arg>
<map>
<entry key="action" value="Timestamp Signature" />
<entry key="user" value=--REMOVED-- />
<entry key="signaturePropFile" value=--REMOVED-- />
<entry key="encryptionPropFile" value=--REMOVED-- />
<entry key="encryptionUser" value=--REMOVED--/>
<entry key="useSingleCertificate" value="true"/>
<entry key="signatureKeyIdentifier" value="DirectReference" />
<entry key="passwordCallbackClass" value=--REMOVED-- />
<entry key="signatureParts"
value="{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp;{Element}{http://schemas.xmlsoap.org/soap/envelope/}Body" />
<entry key="signatureAlgorithm" value="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" />
<entry key="sigCanonicalization" value="http://www.w3.org/2001/10/xml-exc-c14n#" />
<entry key="signatureDigestAlgorithm" value="http://www.w3.org/2001/04/xmlenc#sha256" />
</map>
</constructor-arg>
</bean>
EDIT: This looks to be caused by some archive in the runtime. Does anyone know what package builds the soap envelope in the jre and the websphere 8 runtime? That might be where the differences exist. Any help is greatly appreciated!
This actual turned out to have nothing to do with incorrect namespaces or the canonicalization methods. Websphere, by default, was making this call "BSP_compliant" which added some values to the key.
These lines fixed the problem.
Map<String, Object> ctx = ((BindingProvider)port).getRequestContext();
ctx.put(WSHandlerConstants.IS_BSP_COMPLIANT, "false");

ATG-Endeca : Wild Card search configuration

I am wondering if there is a place where we can configure -- how many characters can be searched on for a wildcard. I am using ATG 10.1.2 and Endeca 3.1.2
Currently I am facing an issue in OOTB CRS application, if I search for one character and a '*' (asterisk), the search returns results, however when I do the same with 3 or more characters from the returned results, no results are returned. It returns again after 5 chars and a *.
I am testing this on the auto suggest feature in CRS, also tested the same on the endeca jspref app, same behavior.
I have searched for any flags that can be used to alter the configuration, but there are none as per http://docs.oracle.com/cd/E29584_01/webhelp/IAPAdmin/toc.htm#Dgraph%20flags
Help is appreciated!
UPDATE
I found that the wild card search was not enabled at all. The search query reaching the MDEX contained the * but the results only appeared for exact matches or after auto correction.
FIX
When I found that wildcard search was not working, I changed my schema.csv to contain the dimensions with wildcardsearch set to true. but that didn't help until I changed my
fcm.context.xml
changed the part starting with the comment as described below ::
<!-- this encodes the property default values from the schema feed xls spreadsheet -->
<bean id="propertyTemplate" class="com.endeca.itl.fcm.beans.PropertyConfiguration">
<property name="language" value="${LANGUAGE_ID}" />
<property name="isSearchable" value="false" />
<property name="isWildcardSearchable" value="true" />
<property name="isSortable" value="false" />
<property name="isFilterable" value="false" />
<property name="showOnListPage" value="true" />
<property name="showOnDetailPage" value="true" />
<property name="enableForRollup" value="false" />
</bean>
now it's working fine.

Is it possible to require min and max string length for param in wsdl file?

I am creating a web service using php SOAPServer. I am creating a wsdl file and looking for info on how to set the min and max string length for one of the input parameters for one of the web service operations. Is it even possible?
By the way I am using soap binding style "rpc"
Do you code the WSDL by hand or does the library create it for you by looking at an endpoint class? If you are coding the WSDL by hand, you could simply add something like this in your schema descriptor:
<simpleType name="MyStringType">
<restriction base="string">
<minLength value="10" />
<maxLength value="30" />
</restriction>
</simpleType>
<element name="greetMe">
<complexType>
<sequence>
<element name="requestType"
type="tns:MyStringType"/>
</sequence>
</complexType>
</element>
Its probably because the service's validation is turned off. Check your framework and see if there is a flag that needs to be set in one of the xml's (application-context.xml) for the service config.