Foreach NodeList Enumerator in biml - ssis

i have a foreach loop which traverse through the xml.
i know how to add this kind of foreach in SSIS. but not able to find the code snippet of biml for the same.
how to mentioned below properties in foreachloopcontainer in biml
Enumerator= Foreach NodeList Enumerator
DocumentSourceType=Variable
DocumentSource
EnumerationType = NodeText
OuterXPathStringSourceType= DirectInput
OuterXPathString = /ROOT/*
any help in having sample code for writing foreachloopcontainer with nodelist enumerator would be a greate help!!!

If you'd like to use a variable as your input source, then you're looking for VariableInput
EnumerationType is exposed in the ForEachNodeListLoop
DirectOuterXPath is where you specify your OuterXPathStringSource, like <DirectOuterXPath>/ROOT/*</DirectOuterXPath>
While not an exact representation of your request (I use Variables across the board), to shred<Files><File>Foo.txt</File><File>Bar.txt</File><File>Blee.txt</File></Files> into Foo.txt, Bar.txt and Blee.txt
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Packages>
<Package Name="so_36759813">
<Variables>
<Variable DataType="String" Name="CurrentNode"></Variable>
<Variable DataType="String" Name="SourceXML"><![CDATA[<Files><File>Foo.txt</File><File>Bar.txt</File><File>Blee.txt</File></Files>]]></Variable>
<Variable DataType="String" Name="OuterXPath"><![CDATA[/Files/File]]></Variable>
<Variable DataType="String" Name="InnerXPath"><![CDATA[.]]></Variable>
</Variables>
<Tasks>
<ForEachNodeListLoop
Name="FENLL Shred XML"
EnumerationType="ElementCollection"
InnerElementType="NodeText"
>
<VariableInput VariableName="User.SourceXML" />
<VariableOuterXPath VariableName="User.OuterXPath" />
<VariableInnerXPath VariableName="User.InnerXPath" />
<VariableMappings>
<VariableMapping VariableName="User.CurrentNode" Name="0" />
</VariableMappings>
<Tasks>
<Script ProjectCoreName="ST_EchoBack" Name="SCR Echo Back">
<ScriptTaskProjectReference ScriptTaskProjectName="ST_EchoBack" />
</Script>
</Tasks>
</ForEachNodeListLoop>
</Tasks>
</Package>
</Packages>
<ScriptProjects>
<ScriptTaskProject ProjectCoreName="ST_EchoBack" Name="ST_EchoBack" VstaMajorVersion="0">
<ReadOnlyVariables>
<Variable Namespace="User" VariableName="CurrentNode" DataType="String" />
</ReadOnlyVariables>
<Files>
<File Path="ScriptMain.cs" BuildAction="Compile">using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
namespace ST_EchoBack
{
[Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
{
public void Main()
{
bool fireAgain = false;
string message = "{0}::{1} : {2}";
foreach (var item in Dts.Variables)
{
Dts.Events.FireInformation(0, "SCR Echo Back", string.Format(message, item.Namespace, item.Name, item.Value), string.Empty, 0, ref fireAgain);
}
Dts.TaskResult = (int)ScriptResults.Success;
}
enum ScriptResults
{
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
};
}
} </File>
<File Path="Properties\AssemblyInfo.cs" BuildAction="Compile">
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyVersion("1.0.*")]
</File>
</Files>
<AssemblyReferences>
<AssemblyReference AssemblyPath="System" />
<AssemblyReference AssemblyPath="System.Data" />
<AssemblyReference AssemblyPath="System.Windows.Forms" />
<AssemblyReference AssemblyPath="System.Xml" />
<AssemblyReference AssemblyPath="Microsoft.SqlServer.ManagedDTS.dll" />
<AssemblyReference AssemblyPath="Microsoft.SqlServer.ScriptTask.dll" />
</AssemblyReferences>
</ScriptTaskProject>
</ScriptProjects>
</Biml>

Related

How to compile BIMLScript depending on generated code

I'm using BIML to create a ScriptComponenteSource, with a ScriptComponentProject.
The project contains the following (which is taken from the Varigence samples)
<ScriptProjects>
<ScriptComponentProject Name="SC_AD-Accounts" TargetFrameworkVersion="NetFX461">
<AssemblyReferences>
<AssemblyReference AssemblyPath="System" />
<AssemblyReference AssemblyPath="System.Data" />
<AssemblyReference AssemblyPath="System.Windows.Forms" />
<AssemblyReference AssemblyPath="System.Xml" />
<AssemblyReference AssemblyPath="Microsoft.SqlServer.TxScript" />
<AssemblyReference AssemblyPath="Microsoft.SqlServer.DTSRuntimeWrap" />
<AssemblyReference AssemblyPath="Microsoft.SqlServer.DTSPipelineWrap" />
<AssemblyReference AssemblyPath="Microsoft.SqlServer.PipelineHost" />
<AssemblyReference AssemblyPath="System.DirectoryServices" />
</AssemblyReferences>
<OutputBuffers>
<OutputBuffer Name="Output0">
<Columns>
<Column Name="UUId" DataType="String" Length="255" />
<Column Name="Surname" DataType="String" Length="255" />
<Column Name="GivenName" DataType="String" Length="255" />
<Column Name="EmailAddress" DataType="String" Length="255" />
<Column Name="UPN" DataType="String" Length="255" />
</Columns>
</OutputBuffer>
</OutputBuffers>
<Files>
<File Path="main.cs"><![CDATA[
using System;
using System.Data;
using System.DirectoryServices;
using Microsoft.SqlServer.Dts.Pipeline;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;
[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
public partial class ScriptMain : UserComponent
{
public override void CreateNewOutputRows()
{
/*
Add rows by calling the AddRow method on the member variable named "<Output Name>Buffer".
For example, call MyOutputBuffer.AddRow() if your output was named "MyOutput".
*/
var searchBaseNames = new [] {
"OU=UserP,OU=User,DC=MyDC",
"OU=UserPS,OU=User,DC=MyDC",
"OU=UserPSC,OU=User,DC=MyDC"
};
var propertiesToLoad = new [] {
"sn",
"givenName",
"mail",
"userPrincipalName",
"objectGuid",
"serialNumber"
};
foreach (var searchBaseName in searchBaseNames) {
var searchBaseEntry = new DirectoryEntry("LDAP://" + searchBaseName);
var directorySearcher = new DirectorySearcher(searchBaseEntry, "(objectClass=user)", propertiesToLoad, SearchScope.Subtree) {
PageSize = 2500
};
foreach (SearchResult searchResult in directorySearcher.FindAll()) {
var surname = searchResult.Properties["sn"][0] as string;
var givenName = searchResult.Properties["givenName"][0] as string;
var email = searchResult.Properties["mail"][0] as string;
var upn = searchResult.Properties["userPrincipalName"][0] as string;
string uuid = null;
if(searchResult.Properties.Contains("serialNumber"))
{
uuid = searchResult.Properties["serialNumber"][0] as string;
if(!string.IsNullOrEmpty(uuid))
uuid = uuid;
}
if(string.IsNullOrEmpty(uuid))
{
var objectGuidBytes = searchResult.Properties["objectGuid"][0] as byte[];
var objectGuid = new Guid(objectGuidBytes);
uuid = objectGuid.ToString();
}
if(string.IsNullOrEmpty(surname) || string.IsNullOrEmpty(givenName) ||
string.IsNullOrEmpty(upn) || string.IsNullOrEmpty(email))
{
continue;
}
Output0Buffer.AddRow();
Output0Buffer.Surname = surname;
Output0Buffer.GivenName = givenName;
Output0Buffer.UPN = upn;
Output0Buffer.EmailAddress = email;
}
}
}
}
]]></File>
</Files>
</ScriptComponentProject>
</ScriptProjects>
This will not compile, due to the BIML-expansion not knowing about Output0Buffer and the overriden method (they will be created automatically).
Is there a way to resolve this hen-egg-problem?
I blogged about it,
https://billfellows.blogspot.com/2015/10/biml-script-component-source.html
You need to specify the IsSynchronous property as false for the output buffer. Otherwise, it will treat the component as a synchronous transformation.
<OutputBuffer Name="Output0" IsSynchronous="false">
Good me on commenting my code
<OutputBuffers>
<!--
Define what your buffer is called and what it looks like
Must set IsSynchronous as false. Otherwise it is a transformation
(one row enters, one row leaves) and not a source.
-->
<OutputBuffer Name="DemoOutput" IsSynchronous="false">
<Columns>
<Column Name="SourceColumn" DataType="String" Length="50" />
</Columns>
</OutputBuffer>
</OutputBuffers>

Junk Data added in json response when deployed on websphere app server 8.5 IBM

we are new at WebSphere deployment. Junk data get added in JSON response after deploying Struts 2 based web application WebSphere 8.5 on Linux platform .But same is working fine with web-logic ,tomcat ,glass-fish ..
We are not receiving any Exception in SystemOut or SystemErr.log file .
Sample response from our application :
{"code":0,"data":{"some data"}}¬‹í\ís›8 ÿW<|Î]yÇä ¶IÊS¿ÁIsM†áEN™8à³qÛ\'ÿû³’0–N®©›¹Ì\'SÂîJúíj -VïRR¤H:•O¤4*#éô»äa2
f“ax6tÎ¥SõDrÇ \…Þ#:•ô»¹×¿”N¤Ñ¼çøïÝ %çÛå ˆ“yØŸÏfî¸Ä? Ц3wäÍGát6 Mo2v†áȇž ÑrƒN$Ï ?\õÝSoæ÷dV|ìát8÷i»r½þÜßmè*
3pgÞ… x nè
‡“K ³ `ôfèôû“ù8‡ž¬H§ŸnN$
ÇÞ8 ¸ã
}¬;îèô“ mRúá§G/š,Ý<Ö¶p?ö߇~ÏgšÓŸ÷ü~HTý?}’zS#Hèa0©~v8pwG¿š²¿B‡~-îÇ“prrW¾„±º³àl6ªnýÑ( 9³ ` Òúæf7ôÀ%ÃS
½qàΰézÎø˜6
Java code:
public class MasterDataAccess extends ActionSupport ModelDriven<AccessBean> {
public String execute() throws Exception {
try {
byte[] b=jsonResp.getBytes("UTF-8");
final InputStream inputStream = new ByteArrayInputStream(b,0,b.length);
requestBean.setInputStream(inputStream);
}
catch(Exception e) {
e.printStackTrace();
}
}
}
public class AccessBean {
private String terminal;
public void setTerminal(String terminal) {
this.terminal = terminal;
}
public void setInputStream(final InputStream inputStream) {
this.inputStream = inputStream;
}
}
Struts XML:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN" "http://struts.apache.org/dtds/struts-2.5.dtd"> (http://struts.apache.org/dtds/struts-2.5.dtd%27%3E)
<struts>
<constant name="struts.devMode" value="false" />
<package name="struts" namespace="/" extends="struts-default">
<interceptors>
<interceptor name="SessionInterceptor" class="com.sagar.interceptors.SessionInterceptor"></interceptor>
<interceptor name="ParameterInterceptor" class="com.sagar.interceptors.ParameterInterceptor"></interceptor>
<interceptor name="OrderInterceptor" class="com.sagar.interceptors.OrderInterceptor"></interceptor>
<interceptor-stack name="commonStack">
<interceptor-ref name="timer" />
<interceptor-ref name="SessionInterceptor" />
<interceptor-ref name="ParameterInterceptor" />
<interceptor-ref name="defaultStack" />
</interceptor-stack>
</interceptors>
<global-results>
<result name="unhandledError">/unhandledErrorPage.jsp</result>
</global-results>
<global-exception-mappings>
<exception-mapping exception="java.lang.Exception" result="unhandledError" />
</global-exception-mappings>
<action name="masterData" class="com.sagar.common.services.MasterDataAccess">
<interceptor-ref name="commonStack" />
<result type="stream" name="success">
<param name="contentType">text/plain</param>
<param name="inputName">inputStream</param>
</result>
</action>
</struts>

SSIS OnVariableValueChanged not fired

I am generating a SSIS dtsx using BIML.
I want every change of a value of any variable to be logged.
I have several variables, all with RaiseChangeEvent at TRUE.
I have a OnVariableValueChanged event handler set for the package and for the dataflow where the variables are changed (by a Count Row).
When I execute the dtsx I see the handler is not even called.
I tried with other events and they are called.
So what is preventing the OnVariableValueChanged to be handled?
All the variables will be set to 0 or positive values and I made sure they start with a value of -1 in order to be sure there will actually be a change of value.
This seems to work for me. I create a variable with RaiseChangedEvent set to true. I then have a For Loop increment that value. I have a script task inside the for loop logging the value and an Event Handler attached to the package for the OnVariableValueChanged event. There I have a sequence container and a script task (disabled). If I put a breakpoint on the container, I can see that it is being called. Enabling the script task there, despite being the same code as in the control flow, results in a timeout error for locking the variable. /shrug
<!-- http://stackoverflow.com/q/42945383/181965 -->
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Packages>
<Package Name="so_42945383" >
<Variables>
<Variable DataType="Int32" Name="IndexCurrent" RaiseChangedEvent="true">-1</Variable>
<Variable DataType="Int32" Name="IndexStart">0</Variable>
<Variable DataType="Int32" Name="IndexStop">1</Variable>
</Variables>
<Tasks>
<ForLoop Name="FLT Modify values" ConstraintMode="Linear">
<InitializerExpression><![CDATA[#[User::IndexCurrent] = #[User::IndexStart]]]></InitializerExpression>
<LoopTestExpression><![CDATA[#[User::IndexCurrent] <= #[User::IndexStop]]]></LoopTestExpression>
<CountingExpression><![CDATA[#[User::IndexCurrent] = #[User::IndexCurrent] + 1]]></CountingExpression>
<Tasks>
<Container Name="SEQC Do nothing" />
<Script ProjectCoreName="FLT_ST_EchoBack" Name="SCR Echo Back FLT">
<ScriptTaskProjectReference ScriptTaskProjectName="ST_EchoBack" />
</Script>
</Tasks>
</ForLoop>
</Tasks>
<Events>
<Event Name="OVVC" EventType="OnVariableValueChanged">
<Tasks>
<Container Name="SEQC Do nothing" />
<Script ProjectCoreName="OVCC_ST_EchoBack" Name="SCR Echo Back OVVC" Disabled="true">
<ScriptTaskProjectReference ScriptTaskProjectName="ST_EchoBack" />
</Script>
</Tasks>
</Event>
</Events>
</Package>
</Packages>
<ScriptProjects>
<ScriptTaskProject ProjectCoreName="ST_EchoBack" Name="ST_EchoBack" VstaMajorVersion="0">
<ReadOnlyVariables>
<!-- List all the variables you are interested in tracking -->
<Variable Namespace="User" VariableName="IndexCurrent" DataType="Int32" />
<Variable Namespace="User" VariableName="IndexStart" DataType="Int32" />
<Variable Namespace="User" VariableName="IndexStop" DataType="Int32" />
</ReadOnlyVariables>
<Files>
<File Path="ScriptMain.cs" BuildAction="Compile">using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
namespace ST_EchoBack
{
[Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
{
public void Main()
{
bool fireAgain = false;
string message = "{0}::{1} : {2}";
foreach (var item in Dts.Variables)
{
Dts.Events.FireInformation(0, "SCR Echo Back", string.Format(message, item.Namespace, item.Name, item.Value), string.Empty, 0, ref fireAgain);
}
Dts.TaskResult = (int)ScriptResults.Success;
}
enum ScriptResults
{
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
};
}
} </File>
<File Path="Properties\AssemblyInfo.cs" BuildAction="Compile">
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyVersion("1.0.*")]
</File>
</Files>
<AssemblyReferences>
<AssemblyReference AssemblyPath="System" />
<AssemblyReference AssemblyPath="System.Data" />
<AssemblyReference AssemblyPath="System.Windows.Forms" />
<AssemblyReference AssemblyPath="System.Xml" />
<AssemblyReference AssemblyPath="Microsoft.SqlServer.ManagedDTS.dll" />
<AssemblyReference AssemblyPath="Microsoft.SqlServer.ScriptTask.dll" />
</AssemblyReferences>
</ScriptTaskProject>
</ScriptProjects>
</Biml>

Biml Master-Child package connections

In a 2008 BIDS/SQL Server/SSIS dev environment (along with BIDS Helper v1.70), I'm trying to create a biml master package that executes the child packages already built under Rootnode. Also using a config file to be able to run the entire process on different servers.
Config File
?xml version="1.0"?>
<DTSConfiguration>
<DTSConfigurationHeading><DTSConfigurationFileInfo GeneratedBy="XXXXXX" GeneratedDate="7/28/2016 1:28:29 PM"/></DTSConfigurationHeading>
<Configuration ConfiguredType="Property" Path="\Package.Connections[dw].Properties[ConnectionString]" ValueType="String">
<ConfiguredValue>Data Source=imsqldv50s\euc;Initial Catalog=CDODW;Provider=SQLNCLI10.1;Integrated Security=SSPI;</ConfiguredValue>
</Configuration>
<Configuration ConfiguredType="Property" Path="\Package.Connections[PkgFile].Properties[ConnectionString]" ValueType="String">
<ConfiguredValue>\\IMSQLDV50s\EUCPACKAGES\CDODW\Load CDODW Tables Biml\</ConfiguredValue>
</Configuration>
<Configuration ConfiguredType="Property" Path="\Package.Variables[User::ChildPackagePath].Properties[Value]" ValueType="String">
<ConfiguredValue>\\IMSQLDV50s\EUCPACKAGES\CDODW\Load CDODW Tables Biml\</ConfiguredValue>
</Configuration>
</DTSConfiguration>
The building of the child packages has been tested and passed. Now we are attempting to build the Master Package.
05-load-edw-master.biml
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Packages>
<Package Name ="Master EDW Load" ConstraintMode ="Linear">
<PackageConfigurations>
<PackageConfiguration Name="dw">
<ExternalFileInput ExternalFilePath="C:\SSISConfig\CDODW_ETL_Load.dtsConfig" />
<ConfigurationValues>
<ConfigurationValue DataType="String" Name="dw" PropertyPath="\Package.Connections[dw].Properties[ConnectionString]" Value=""></ConfigurationValue>
</ConfigurationValues>
</PackageConfiguration>
<PackageConfiguration Name="PkgFile">
<ExternalFileInput ExternalFilePath="C:\SSISConfig\CDODW_ETL_Load.dtsConfig" />
<ConfigurationValues>
<ConfigurationValue DataType="String" Name="PkgFile" PropertyPath="\Package.Connections[PkgFile].Properties[ConnectionString]" Value=""></ConfigurationValue>
</ConfigurationValues>
</PackageConfiguration>
</PackageConfigurations>
<#=CallBimlScript("cbs-pkg-params-variables.biml", "No Table", "master-load", "","","")#>
<!--
<Connections>
<Connection ConnectionName="dw" />
<Connection ConnectionName="PkgFile">
<Expressions>
<Expression PropertyName="PkgFile.ConnectionString">#[User::ChildPackagePath]</Expression>
</Expressions>
</Connection>
</Connections>
-->
<Tasks>
<#=CallBimlScript("cbs-sql-audit-begin.biml", "master-load")#>
<Container Name="SEQ Load Dimensions" ConstraintMode="Linear">
<Tasks>
<# foreach (var package in RootNode.Packages.Where(pkg => pkg.GetTag("type")=="load-edw-dim").OrderBy(pkg => pkg.GetTag("LoadOrder"))) { #>
<ExecutePackage Name="EP <#=package.Name#>" DelayValidation="true">
<Package PackageName="<#=package.Name #>" />
</ExecutePackage>
<# } #>
</Tasks>
</Container>
<Container Name="SEQ Load Facts" ConstraintMode="Linear">
<Tasks>
<# foreach (var package in RootNode.Packages.Where(pkg => pkg.GetTag("type")=="load-edw-fact").OrderBy(pkg => pkg.GetTag("LoadOrder"))) { #>
<ExecutePackage Name="EP <#=package.Name #>" DelayValidation="true">
<Package PackageName="<#=package.Name #>" />
</ExecutePackage>
<# } #>
</Tasks>
</Container>
<#=CallBimlScript("cbs-sql-audit-end.biml")#>
</Tasks>
<Annotations>
<Annotation AnnotationType="Tag" Tag="type">master-load</Annotation>
</Annotations>
</Package>
</Packages>
</Biml>
<## template language="C#" tier="5"#>
The Connections have already been defined in a tier 1 file
After generating the packages, I note that the Biml engine creates Connection Managers using a convention "_" + Master Package Name.SequenceContainerName.ExecutePackageName, with a connection string pointing to the local file path. And it's doing so "under the covers" as there is no clue in the expanded biml file of how it's done!
Is there a nice simple way to interject a passed-in file path from the config file that can be recognized and used to build each FileConnection's data? I thought it would make sense to store the relevant file location in a variable (fed from the config file) and somehow use that to develop the ConnectionString from the package name garnered from the foreach snippet, but the engine doesn't appear to like that.
Any help is appreciated.
Thanks!

Endpoint not found WCF

I have WCF library that I hosted , the login function work well, but the second function ReturnCounter
the interface is :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Web;
namespace PMAService
{
[ServiceContract]
public interface IPMA
{
[OperationContract]
string Login(string username, string password);
[OperationContract]
List<usp_ReturnEncounter_Result> ReturnEncounter();
}
}
and the code is
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel.Web;
using System.Security.Cryptography;
using System.Web.Security;
namespace PMAService
{
public class PMA : IPMA
{
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "LogIn/{username}/{password}")]
public string Login(string username, string password)
{
if (Membership.ValidateUser(username, password))
return "true";
else
return "false";
}
// Method to retrieve the Counter
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "ReturnEncounter")]
public List<usp_ReturnEncounter_Result> ReturnEncounter()
{
using (PMAEntities context = new PMAEntities())
{
return context.usp_ReturnEncounter().ToList();
}
}
}
}
where I connect to Entity framework
the web.config look like
<?xml version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<roleManager enabled="true" />
<membership>
<providers>
<remove name="AspNetSqlMembershipProvider"/>
<add name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="Login"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
applicationName="/"
requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="1"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression="" />
</providers>
</membership>
<authentication mode="Windows"/>
<customErrors mode="On"/>
</system.web>
<system.serviceModel>
<services>
<service name="PMAService.PMA">
<endpoint binding="webHttpBinding" contract="PMAService.IPMA" behaviorConfiguration="web">
</endpoint>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
the login/x/y work well, while ReturnCounter give the error endpoint not found
any idea to fix that please
First of all enable Tracing on your Service and see what is the cause for exception.
Also you would consider increasing ReaderQuotas on your server and client side so that larger data is passed without any problem. Sample shown below:
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
<security mode="None" />
</binding>
</webHttpBinding>
</bindings>
</system.serviceModel>  
 
Also i see in your code that you are passing the object fetched by entity framework directly. There are situations where the entity framework objects dont get deserialzed and might cause exception. Create a simple POCO and then populate the fetched data and return the POCO.
Why WebInvoke?
For use of a Get operation you need to use WebGet for this Method.
WebInvoke is for just Executing Insert Update Delete uperations.
We use POST, PUT and DELETE method names for them.(Orderly)
When you need to get some data you should do something like that,
[WebGet(UriTemplate = "ReturnEncounter",
RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
As you notice there is a request format this may be XML or JSON enumed on WebMessageFormat.
For post ops. you may use WebRequest object.
Hope helps.