Generating wcf ServiceClients, reference problem - wcf

I am trying to generate ServiceClient classes.
I have 2 Projects, API and WEB.
The API project contains both ClassLibrary and DataContracts/Interface class files. I have a website which has the SVC files. WEB references the API project.
When I to generate the the Service Client classes, they generate in the API project
Here is the problem I am having
My SvcUtil command line includes /Reference: [full location of API /bin/debug/API.dll ]. It is the same path as the build output from the API project.
When I run the SvcUtil command with that /Reference, the generation fails and I see the following cutdown summary of messages.
Attempting to download metadata from
'http://id.unittest/Services/EchoService.svc?wsdl'
using WS-Metadata Exchange or DISCO.
Error: Cannot import wsdl:binding
Detail: Cannot locate operation IsSubscribed in Contract IEchoService.
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://tempuri.org/']
/wsdl:binding[#name='WSHttpBinding_IEchoService']
Error: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent
on.
XPath to wsdl:binding: //wsdl:definitions[#targetNamespace='http://tempuri.org/']
/wsdl:binding[#name='WSHttpBinding_IEchoService']
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://tempuri.org/']
/wsdl:service[#name='EchoService']/wsdl:port[#name='WSHttpBinding_IEchoService']
Generating files...
Warning: No code was generated.
If you were trying to generate a client, this could be because the metadata documents
did not contain any valid contracts or services
or because all contracts/services were discovered to exist in /reference assemblies.
Verify that you passed all the metadata documents to the tool.
Warning: If you would like to generate data contracts from schemas make sure
to use the /dataContractOnly option.
When I remove the /reference, the generation succeeds, but a duplicate set of entity classes that were used in the methods params are generated. When I try to build my API project, I get an error that there are duplicate classes names and that I should change them to partial. So, dont want and need those extra classes.
Hopefully I have provided enough information. Thanks.

The solution was to add the following switches to the svcutil command
/serializer:DataContractSerializer /serializable
Reference url: MSDN forum

Related

Error while starting a workflow in sensenet (Basic workflow)

I was trying to enable/configure basic workflow in sensenet back-end application. I performed the following steps and I am getting the error mentioned below.
Steps performed
I had enabled approval for one document library (Home / workspaces / Document Workspaces / London Document Workspace / Document library) in Sensenet demo server
I assigned workflow for approval and checked all 4 available options for initiating workflow
I created a new content and while uploading (all workflows were set to automatically execute), I got the following error
The following errors were encountered while processing the workflow tree:\n DynamicActivity : The private implementation of activity 1: DynamicActivity has the following validation error: Compiler error(s) encountered processing expression CType(StateContent( Workspace ), SenseNet.ContentRepository.GenericContent).Path & /Tasks .\nReference required to assembly netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 containing the base class System.Object . Add one to your project.\n
How can I rectify this?

Error on importing Wsdl as a connected service

I have an application that targets .NET Core.
When I try to import a wsdl file, I get the following error.
Scaffolding Code ...
Error:Error: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Schema with target namespace 'http://xml.amadeus.com/2010/06/Session_v3' could not be found.
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://xml.amadeus.com']/wsdl:portType[#name='AmadeusWebServicesPT']
Warning: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: //wsdl:definitions[#targetNamespace='http://xml.amadeus.com']/wsdl:portType[#name='AmadeusWebServicesPT']
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://xml.amadeus.com']/wsdl:binding[#name='AmadeusWebServicesBinding']
Warning: Cannot import wsdl:port
Detail:
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://xml.amadeus.com']/wsdl:service[#name='AmadeusWebServices']/wsdl:port[#name='AmadeusWebServicesPort']
Error: No endpoints compatible with .Net Core apps were found.
An error occurred in the tool.
Failed to generate service reference.
Is there any solution or workaround to that problem ?
Thanks.
Edit:
I have figured out the problem. To re-generate the stub, I need to run "svcutil.exe" directly from the command line (or generate the stub in some dummy C# project) because WCF Connected Services cannot generate a stub from this WSDL.
The generated code of the regarding wsdl uses following attributes that are not supported by .Net Standard 1.6.
SerializableAttribute, DesignerCategoryAttribute
When I create these two attributes manually, then I am able to make my application build.
We can add services in 2 ways from addservices or from dotnet-svcutil tool.
The problem is that your web service endpoint's WSDL uses a different way of storing the XML operation data. As Henk points out, using the wrapped flag when manually running the dotnet-svcutil tool is the solution here.
Follow these steps:
Edit your .csproj file and add the following node inside the <ItemGroup> node: <DotNetCliToolReference Include="dotnet-svcutil" Version="1.0.*" />
Open up a PowerShell terminal from within the folder where the .csproj file resides.
Run dotnet restore
Run dotnet svcutil https://smp.difi.no/ws/2.0?wsdl -wr

WSO2 Identity / How to Register XACML PIP Java Extension and its Claims

Scanning through the WSO2 documentation and several blogs, I found three different type of registry mechanisms to add new claims to a Java PIP module:
By use of setup file calledentitlement.properties and by adding of Java static properties for each variable as described in the
sample case from the WSO2 manual, see: Writing a Custom Policy Info Point;
By use of supportedAttributesIds.add as described in link How to write a PIP point for WSO2 IS;
By use of a setter method: public Set getSupportedIds() { Set<String> ids = new HashSet<String>(); ids.add("http://kmarket.com/id/role"); return ids; } as described in the Stackoverflow post How To Add User Defined Attribute in PIP Attribute User Store
Please instruct which of the three options is the updated and recommended solution for adding new fields produced by the lookup of external data sources executed by the Balana PIP as an extension of the "AttributeFinderModule" class.
I've also tested the code posted in this example and compiled it with Java 6 JDK, see source reference
How To Add User Defined Attribute in PIP Attribute User Store
After the restart, the WSO2 server continues to display the following error:
Error while loading entitlement policies. Exception occurred while trying to invoke service method getAllPolicies
The following error details are available. Please refer logs for more details.
org.apache.axis2.AxisFault: Exception occurred while trying to invoke service method getAllPolicies
at org.wso2.carbon.identity.entitlement.ui.client.EntitlementPolicyAdminServiceClient.handleException(EntitlementPolicyAdminServiceClient.java:478)
at org.wso2.carbon.identity.entitlement.ui.client.EntitlementPolicyAdminServiceClient.getAllPolicies(EntitlementPolicyAdminServiceClient.java:81)
at org.apache.jsp.entitlement.index_jsp._jspService(org.apache.jsp.entitlement.index_jsp:183)
when adding the extended AttributeFinder Java extension. Is this a known bug in the WSO2 server?
The first way is configurable, you don't need to rebuild and deploy the PIP when you want to add new attibute. You just have to add them to entitlement.properties file. and restart the IS.
In other two ways, you have to rebuild the PIP module for each attribute changes.
But, If you are going to add and attribute, you have to implement the logic for that too, so in that case going for last two ways also make sense.
I've replaced the KmarketPIPAttributeFinder program module by the latest version from the svn source repository (see link below) and compiled it. This solved the problem under WSO2 Identity Server Version 5 and the routine started to register the PIP attributes, now visible at the PDP extensions.
Download the latest code from: https://svn.wso2.org/repos/wso2/carbon/platform/trunk/components/identity/org.wso2.carbon.identity.samples.entitlement.pip/src/main/java/org/wso2/carbon/identity/samples/entitlement/pip/KmarketPIPAttributeFinder.java

Reflexil deobfustication error

I'm trying to modify a .net application and I'm new to this. First step is attempting to deobfuscate the code using reflexil and I get the following error:
Reflexil is unable to clean this assembly: Member 'System.RuntimeTypeHandle "bunch of obfustatcated jibberish"(System.Int32)' is declared in another module and needs to be imported
The application comes with a bunch of dll's that it certainly uses, so I assume the declaration is in one of those files. How do I import this module?
In case it's helpful, reflexil says it was obfuscated with .NET Reactor 4.1
I decided to try de4not to deobfuscate and it worked without this issue.

MonoDevelop and AjaxControlToolkit: Register Server Tag in Mono

I know that Mono supports the AjaxControlToolkit but I don't know how to integrate it into MonoDevelop. I added AjaxControlToolkit.dll, System.Web.Extensions.dll and System.Web.Extensions.Design.dll as References in the project but when I build the project I get the warning:
/Users/user1/Projects/FirstProject/Default.aspx(1,1): Warning: Parser failed with error The tag type 'ajaxToolkit:TabContainer' has not been registered.. CodeBehind members for this file will not be added. (FirstProject)
and I when I deploy it I get the error: Unknown server tag 'ajaxToolkit:TabContainer'.
How do I register the server tag in MonoDevelop?
You can use either the <%#Register directive, or add some lines to your Web.config. See here for instructions on either approach.
Using the Web.config mechanism has the advantage that you don't need to add a directive to every page where you want to use the controls.