here is how to amke header in wcf service
ASMX to WCF Migration with SOAP Header | The ASP.NET Forums:
This Blog is first of all memos for me!! From time to time I get exposed to new and cool stuff for developers and architects ,most of the time its a solution for a problem or tips or tricks, so, I would like to track my memos and share it with you, it can save your time and nervous, I hope you will enjoy it - by Yaniv Tzanany.
Search This Blog
Showing posts with label WCF. Show all posts
Showing posts with label WCF. Show all posts
Tuesday, September 2, 2014
Monday, August 4, 2014
Tuesday, July 22, 2014
WCF Tools
there is this tool SvcConfigEditor.exe - The Windows Communication Foundation (WCF) Service Configuration Editor (SvcConfigEditor.exe) allows administrators and developers to create and modify configuration settings for WCF services using a graphical user interface. With this tool, you can manage settings for WCF bindings, behaviors, services, and diagnostics without having to directly edit XML configuration files.
Service Trace Viewer Tool - (SvcTraceViewer.exe) - Windows Communication Foundation (WCF) Service Trace Viewer Tool helps you analyze diagnostic traces that are generated by WCF. Service Trace Viewer provides a way to easily merge, view, and filter trace messages in the log so that you can diagnose, repair, and verify WCF service issues.
WCF Test Client (WcfTestClient.exe) - Windows Communication Foundation (WCF) Test Client (WcfTestClient.exe) is a GUI tool that enables users to input test parameters, submit that input to the service, and view the response that the service sends back. It provides a seamless service testing experience when combined with WCF Service Host.
Trace in WCF - WCF Extensibility – System.Diagnostic Tracing
Yaniv Tzanany
Service Trace Viewer Tool - (SvcTraceViewer.exe) - Windows Communication Foundation (WCF) Service Trace Viewer Tool helps you analyze diagnostic traces that are generated by WCF. Service Trace Viewer provides a way to easily merge, view, and filter trace messages in the log so that you can diagnose, repair, and verify WCF service issues.
WCF Test Client (WcfTestClient.exe) - Windows Communication Foundation (WCF) Test Client (WcfTestClient.exe) is a GUI tool that enables users to input test parameters, submit that input to the service, and view the response that the service sends back. It provides a seamless service testing experience when combined with WCF Service Host.
Trace in WCF - WCF Extensibility – System.Diagnostic Tracing
Yaniv Tzanany
Thursday, November 25, 2010
Introducing to WCF
To start with WCF you must read this article
Introducing Windows Communication Foundation in .NET Framework 4
Introducing Windows Communication Foundation in .NET Framework 4
Monday, November 15, 2010
How to consume WCF service from Java - step by step
Here is a step by step sample how to consume WCF service from java.
WCF in VS.NET (2008 in my case):
create a new project
file->new->project->web->wcf service application
leave the default settings as is , a new WCF service created by the wizard called Service1.svc.
press F5 -> make sure you can see the service page http://localhost:2813/Service1.svc and his wsdl file
http://localhost:2813/Service1.svc?wsdl.
to connect from java to WCF service we have to change the binding type from the default "wsHttpBinding" to "basicHttpBinding".
to do that , edit the Web.config file
change the end point to somthing like this :
<endpoint address="" binding="basicHttpBinding" bindingconfiguration="Binding1" contract="WcfService1.IService1"> </endpoint>
add the next binding section ( you can change it as you like)
<bindings>
<basicHttpBinding>
<binding name="Binding1"
hostNameComparisonMode="StrongWildcard"
receiveTimeout="00:10:00"
sendTimeout="00:10:00"
openTimeout="00:10:00"
closeTimeout="00:10:00"
maxReceivedMessageSize="65536"
maxBufferSize="65536"
maxBufferPoolSize="524288"
transferMode="Buffered"
messageEncoding="Text"
textEncoding="utf-8"
bypassProxyOnLocal="false"
useDefaultWebProxy="true" >
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
press F5 -> make sure you can see the service page after the changes http://localhost:2813/Service1.svc and his wsdl file http://localhost:2813/Service1.svc?wsdl
JAVA side:
open cmd window
cd to your axis2/bin directory , cd C:\Program Files\Apache Software Foundation\axis2-1.5.2\bin
create directory test in the bin folder , mkdir test.
run the next batch file from your bin directory
wsdl2java.bat -o test -uri http://localhost:2813/Service1.svc?wsdl
the above command should generate the java stub to connect to your wcf service.
Service1CallbackHandler.java and Service1Stub.java.
add those file into your java test program and create your test function.
public static void CallWCFService()
{
try {
Service1Stub srv1 = new Service1Stub();
srv1._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,Boolean.FALSE);
Service1Stub.GetData data = new Service1Stub.GetData();
data.setValue(44);
Service1Stub.GetDataResponse reposne = srv1.getData(data);
System.out.println(reposne.getGetDataResult());
} catch (AxisFault e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if you will remark the yellow line (enable the chunk), you will get the
org.apache.axis2.AxisFault: The input stream for an incoming message is null.
when i disabled the chunk , it works perfect.
i would like to say a special thanks to Yaron Naveh , that guide & helped me to get this works,Yaron have a very informative blog on this subject too, thanks Yaron !!!
From Microsoft article (http://msdn.microsoft.com/library/ee958158.aspx)
“For communication with the Java EE-based reservation application, a binding that uses standard SOAP on the wire is required. If the application and the platform it runs on support some or all of the WS-* specifications, the endpoint used by this client might choose WsHttpBinding. This would allow reliable, secure, and transactional communication between the two applications.
If this application and the platform it runs on support only standard SOAP matching the WS-I Basic Profile, however, the endpoint it uses to access the rental car reservation application would use BasicHttpBinding. If transport security is required, this binding could be configured to use HTTPS instead of plain HTTP.”
enjoy
Yaniv Tzanany
WCF in VS.NET (2008 in my case):
create a new project
file->new->project->web->wcf service application
leave the default settings as is , a new WCF service created by the wizard called Service1.svc.
press F5 -> make sure you can see the service page http://localhost:2813/Service1.svc and his wsdl file
http://localhost:2813/Service1.svc?wsdl.
to connect from java to WCF service we have to change the binding type from the default "wsHttpBinding" to "basicHttpBinding".
to do that , edit the Web.config file
change the end point to somthing like this :
<endpoint address="" binding="basicHttpBinding" bindingconfiguration="Binding1" contract="WcfService1.IService1"> </endpoint>
add the next binding section ( you can change it as you like)
<bindings>
<basicHttpBinding>
<binding name="Binding1"
hostNameComparisonMode="StrongWildcard"
receiveTimeout="00:10:00"
sendTimeout="00:10:00"
openTimeout="00:10:00"
closeTimeout="00:10:00"
maxReceivedMessageSize="65536"
maxBufferSize="65536"
maxBufferPoolSize="524288"
transferMode="Buffered"
messageEncoding="Text"
textEncoding="utf-8"
bypassProxyOnLocal="false"
useDefaultWebProxy="true" >
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
press F5 -> make sure you can see the service page after the changes http://localhost:2813/Service1.svc and his wsdl file http://localhost:2813/Service1.svc?wsdl
JAVA side:
open cmd window
cd to your axis2/bin directory , cd C:\Program Files\Apache Software Foundation\axis2-1.5.2\bin
create directory test in the bin folder , mkdir test.
run the next batch file from your bin directory
wsdl2java.bat -o test -uri http://localhost:2813/Service1.svc?wsdl
the above command should generate the java stub to connect to your wcf service.
Service1CallbackHandler.java and Service1Stub.java.
add those file into your java test program and create your test function.
public static void CallWCFService()
{
try {
Service1Stub srv1 = new Service1Stub();
srv1._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,Boolean.FALSE);
Service1Stub.GetData data = new Service1Stub.GetData();
data.setValue(44);
Service1Stub.GetDataResponse reposne = srv1.getData(data);
System.out.println(reposne.getGetDataResult());
} catch (AxisFault e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if you will remark the yellow line (enable the chunk), you will get the
org.apache.axis2.AxisFault: The input stream for an incoming message is null.
when i disabled the chunk , it works perfect.
i would like to say a special thanks to Yaron Naveh , that guide & helped me to get this works,Yaron have a very informative blog on this subject too, thanks Yaron !!!
From Microsoft article (http://msdn.microsoft.com/library/ee958158.aspx)
“For communication with the Java EE-based reservation application, a binding that uses standard SOAP on the wire is required. If the application and the platform it runs on support some or all of the WS-* specifications, the endpoint used by this client might choose WsHttpBinding. This would allow reliable, secure, and transactional communication between the two applications.
If this application and the platform it runs on support only standard SOAP matching the WS-I Basic Profile, however, the endpoint it uses to access the rental car reservation application would use BasicHttpBinding. If transport security is required, this binding could be configured to use HTTPS instead of plain HTTP.”
enjoy
Yaniv Tzanany
Sunday, October 17, 2010
WCF Security info / links
here is the complete article : Fundamentals of WCF Security
I found the next article , actually its a step by step description that explains the techniques, architecture and design strategies in order to address one of the most common scenarios of secure communication in Internet, the Anonymous client over Certificate WS-Security scenario using the message level security mechanisms.
Here is another great article about WCF , Hosting and Consuming WCF Services.
another good articles Securing WCF Services with Certificates , An easy way to use certificates for WCF security
enjoy
Yaniv T
I found the next article , actually its a step by step description that explains the techniques, architecture and design strategies in order to address one of the most common scenarios of secure communication in Internet, the Anonymous client over Certificate WS-Security scenario using the message level security mechanisms.
Here is another great article about WCF , Hosting and Consuming WCF Services.
another good articles Securing WCF Services with Certificates , An easy way to use certificates for WCF security
enjoy
Yaniv T
Subscribe to:
Posts (Atom)