We have a Java Web Service (WSDL) and a ASP Client. We are using SOAP Toolkit 3.0 to make calls to the Java web service. The Java web service is exposing objects, so I need to use complex type mappers.
When I am trying this, I am getting the error -
SoapMapper:Saving SoapMapper account failed HRESULT=0x80004002: No such interface supported - Client:Unspecified client error. HRESULT=0x80004002: No such interface supported
The code for this is:
On Error Resume Next
Dim objWebSvcClient
Dim strSuccess
Dim myaccount
set objWebSvcClient = server.CreateObject("MSSOAP.SoapClient30")
objWebSvcClient.ClientProperty("ServerHTTPRequest") = True
objWebSvcClient.MSSoapInit ("c:\TestAsp.wsdl")
class Account
Dim maccid 'As String
Dim maccName 'As String
Public Property Get accId() 'As String
accId = maccid
End Property
Public Property Let accId(ByVal Value )
maccid = Value
End Property
Public Property Get accName() 'As String
accName = maccName
End Property
Public Property Let accName(ByVal Value )
maccName = Value
End Property
End class
Set myaccount = new Account
myaccount.accId = "ABC"
myaccount.accName = "ABC"
strSuccess = objWebSvcClient.setAccount(myaccount)
Please let me know If I am missing out some Information.
Reference to some examples doing the same implementation would also be helpfull.
the statement objWebSvcClient.MSSoapInit ("c:\TestAsp.wsdl") is setting a physical file as a URL. You can parse WSDL this way but the URLs given in the wsdl itself may not working or are with relatively path which will fail.
Try giving the full http url even for the wsdl file.
Related
I am trying to add a new endpoint to a WCF based REST service with the following URL template:
/books/{bookId}/pdf
but it gives an error saying:
The UriTemplate '/books/*/pdf' is not valid; the wildcard ('*') cannot appear in a variable name or literal, unless as a construct for a wildcard segment. Note that a wildcard segment, either a literal or a variable, is valid only as the last path segment in the template; the wildcard can appear only once. See the documentation for UriTemplate for more details.'
Here's the service contract:
[OperationContract]
[WebInvoke(UriTemplate = "/books/{bookId}/pdf", Method = "POST")]
Message GetBookPDF(string bookId);
Is this a limitation that the variable is only valid as the last part of the url? I couldn't find any link that confirms that.
I am sure that the variable needn’t configured in the last part of the URL.
My service contract
public interface ITestService
{
[OperationContract]
[WebInvoke(Method ="POST",UriTemplate ="/books/{id}/pdf")]
string Test(string id);
}
Result.
Please have a look at this link.
https://stackoverflow.com/questions/13956889/in-wcf-can-i-have-a-wildcard-character-in-a-literal-segment-of-my-uritemplate
The most likely scenario is that the UriTemplate can match multiple OperationContract, thus the error happened.
Feel free to let me know if the problem still exists.
I have created a RESTful web service. It is working fine when I run it. But whenever I pass any parameter to that web service through the URL created, I am not able to access that parameter.
The URL of web service is:
http://localhost:8080/Web_service/path/simple/sam
where sam is the parameter passed by me and path is used for accessing the class.
In my web service, I am trying to access the passed parameter as shown in the screenshot below:
This is my code's screenshot
I do not get back the parameter concatenated with "Hello " as I desire, but I only get "Hello " returned.
Please help !
#Get
#Produces(MediaType.TEXT_PLAIN)
#Path("/simple/{tem}")
public String test(#PathVariable("tem") String tem) {
String t = "Hello " + tem;
return t;
}
My goal is to create a strategy of different steps to get from a point-to-point communication between 2 components to a "full blown netflix" style of communication using eureka, ribbon, hystrix. With each iteration I want to add more while I try to limit the amount of changes to the actual code. Feign is my preferred client side framework to make this happen. First step is to create a FeignClient to communicate to the server:
#FeignClient(url = "http://localhost:9000")
interface Client {
#RequestMapping(method = RequestMethod.GET, value = "/author/{author}/addedValue/{addedValue}")
Result addToTotal(#RequestParam(value="author") String author, #RequestParam(value="addedValue") long addedValue);
}
This works but I don't want the URL to be hardcoded in the annotation. I would like to have this: #FeignClient()
and have a properties construct like: client.url: http://localhost:9000
So far I couldn't find any clues on how to configure that and I couldn't find a solution in the spring-cloud sources.
Can it be done and if yes; how?
It can be done with a "serviceId" instead of a "url". E.g.
#FeignClient("foo")
interface Client { ... }
and
foo.ribbon.listOfServers: localhost:9000
e.g. see http://projects.spring.io/spring-cloud/spring-cloud.html#spring-cloud-ribbon-without-eureka for docs.
This can be done like this:
#FeignClient(name="fd-mobileapi-service",url="${fdmobile.ribbon.listOfServers}")
Where fdmobile.ribbon.listOfServers : value is a property in application.properties.
I have tested it and it is working.
I got a way to pass the environment variables in a very simple way interface FeignClient,
#FeignClient(url = "https://"+"\${url}")
interface Client {
#RequestMapping(method = RequestMethod.GET, value = "/author/{author}/addedValue/{addedValue}")
Result addToTotal(#RequestParam(value="author") String author, #RequestParam(value="addedValue") long addedValue);
properties
#URL
url.client=${URL}
.env
URL=https:localhost:9000
I had a GWT servelt on whose doGet method, I created a cookie as shown below:
Cookie nameCookie = new Cookie("name","adam");
response.addCookie(nameCookie);
I tried to read this on the client side as
String name = Cookies.getCookie("name");
But the output of string variable name was coming out as undefined.
I solved it by finding out that while creating a cookie, you also have to set the path for it.
So in the server side,
Cookie nameCookie = new Cookie("name","adam");
nameCookie.setPath("/");
response.addCookie(nameCookie);
Now the following client side code returns the proper value as adam
String name = Cookies.getCookie("name");
Rest client.
Can I add a local variable for value into URL string for a Rest client ?
Example
URL testurl = new URL("http://X.X.X.X:7001/lab2.local.rest1/api/v1/status/database?rxnum=1111");
The above works if I provide literal value for rxnum (i.e. 1111).
But I need rest client to utilize value of a local variable. exam
int rxvalue = 1111;
URL testurl = new URL("http://X.X.X.X:7001/lab2.local.rest1/api/v1/status/database?rxnum=+(rxvalue)+");
this doesn't work, obvious my URL string is incorrect. What is correct syntax to allow URL string to use value of local variable rxvalue?
thanks in advance
URL testurl = new URL("http://X.X.X.X:7001/lab2.local.rest1/api/v1/status/database?rxnum=" +rxvalue);
Simple String concatenation.
You are not building the URL string correctly. It is always a good idea to log url/print to be sure that you are creating the correct url. The problem lies in the way you are trying to concatenate the rxvalue, here is the correction in your code :
String urlString = "http://X.X.X.X:7001/lab2.local.rest1/api/v1/status/database?rxnum=" + rxvalue;
URL testurlWithString = new URL(urlString);
System.out.println(testurlWithString);