java


C# WCF Service and Java Client


Please help with Java Client for C# WCF Service, which is throwing:
Exception in thread "main" javax.xml.ws.WebServiceException: Undefined port type: {http://tempuri.org/}WCFService
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)
at javax.xml.ws.Service.getPort(Unknown Source)
at Client.main(Client.java:20)
```
Here's the Java Code Snippet:
import java.net.URL;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
public class Client {
#WebService(name = "WCFService", targetNamespace = "http://tempuri.org/")
public interface IWCFService {
#WebMethod
String Echo(String input);
}
public static void main(String[] args) throws Exception {
QName port = new QName("http://tempuri.org/", "WCFService");
URL location = new URL("http://localhost:8000/WCFService?wsdl");
Service serv = Service.create(location, port);
IWCFService p = serv.getPort(IWCFService.class);
System.out.println(p.Echo("Hello World!"));
}
}
Here's the WCF Code Snippet:
using System;
using System.ServiceModel;
using System.ServiceModel.Description;
namespace WCFWSDL
{
public class Program
{
[ServiceContract]
public interface IWCFService
{
[OperationContract]
string Echo(string input);
}
public class WCFService : IWCFService
{
public string Echo(string input) { return "Your input: " + input; }
}
public static void Main()
{
string baseAddress = "http://localhost:8000/WCFService";
ServiceHost host = new ServiceHost(typeof(WCFService), new Uri(baseAddress));
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
host.Description.Behaviors.Add(smb);
host.AddServiceEndpoint(typeof(IWCFService), new BasicHttpBinding(), "");
host.Open();
Console.WriteLine("http://localhost:8000/WCFService?wsdl");
Console.WriteLine("Press ENTER to close");
Console.ReadLine();
host.Close();
}
}
}
Thanks

Related Links

How efficient it will be to have a background thread (consumer thread) for a bolt to do operations independent of incoming tuple?
How to programmatically stop JMS listeners from consuming?
JFrame not displaying, nothing is displaying
Creating my own Android library and exporting it to .jar
Can't connect to SMTP server with Java
bufferedReader reads the filename only
How to test for exception that is caught inside method?
How to reverse an ArrayList [closed]
intercepting internet calls android
String Can not converted to JSON Object in Android
Populating a PDF with Java Form
android: Updating a contact using batch method
Http File Transfer using Commons VFS
Error in casting during creation of the Ontology class
Is there any difference between Objects::nonNull and x -> x != null?
Can JXPath find objects by type?

Categories

HOME
vbscript
mediawiki
mfc
adb
at-command
rsync
spring-cloud-stream
v8
sql-server-2016
cross-browser
ezpublish
django-imagekit
facebook-messenger-bot
slurm
rascal
mapserver
alignment
gz
dtrace
jsprit
uitypeeditor
opentracing
pc
invantive-sql
code-review
excel-vba-mac
nhibernate-envers
samoa
nodatime
arabic
graphicsmagick
telerik-reporting
zurb-foundation-6
tibco-mdm
wijmo
spark-jobserver
chromebook
brunch
fopen
fifo
spring-mybatis
dbclient
sql-server-2012-express
yadcf
phonegap
exuberant-ctags
vsts-build-task
phpfreechat
bower-install
hockeyapp
objectlistview
vapor
sas-visual-analytics
galen
botbuilder
midl
import-from-excel
google-datalayer
react-scripts
git-diff
sybase-asa
sqlbulkcopy
chord-diagram
google-cdn
objective-c-swift-bridge
instant
ado.net-entity-data-model
elements
etsy
plottable.js
multiple-regression
packagist
spim
wso2cloud
eclipse-clp
python-3.2
computer-algebra-systems
tarjans-algorithm
arcanist
inmobi
lustre
geonetwork
sorl-thumbnail
qpainter
android-nested-fragment
rdtsc
wordpress-theme-customize
java-metro-framework
flask-cors
project-planning
android-radiobutton
poller
access-rights
bulkloader
ril
spring-validator
ember-app-kit
psi
xmemcached
invite
appender
coda-slider
audio-capture
uimenucontroller
boost-smart-ptr
pascal-fc
caching-application-block
ntvdm.exe

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App