views:

421

answers:

1

Hi, I tried it works fine for the asmx (simple web services) but for WCf do we need to do some thing different.

Can the Same work for the WCF services as i get the error for the WCF service also. i just created the Simple WCF service in .net and tried to access. but was not successful.

Error:

$Url = "http://localhost:4637/WCFService2/Service.svc"

$webclient = new-object System.Net.WebClient

$soapMessage = @"
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/"&gt;
   <soap:Header/>
   <soap:Body>
      <tem:GetData>
         <!--Optional:-->
         <tem:value>hji</tem:value>
      </tem:GetData>
   </soap:Body>
</soap:Envelope>
"@
$webclient.headers.Add("SOAPAction","http://localhost:4637/WCFService2/Service.svc/GetData")
$webclient.headers.Add("Content-Type", "text/xml; charset=utf-8")

$result = ([XML]$webclient.UploadString($Url, $soapMessage))#.envelope.body.GetWeatherByPlaceNameResponse.GetWeatherByPlaceNameResult

$result
A: 

Do you really want to manually fill in the SOAP packet and send it? If not, then do a Get-Help on New-WebServiceProxy assuming you are running PowerShell 2.0. This cmdlet will create a proxy object that you can directly program against.

Keith Hill
I was able to get the Proxy usibng the New-WebServiceProxy but befor i access the methods i recquire to pass the LoginToken created from other service as a header or cookie to access the methods of the services. So my now main concern is how will now pass this authentication token (Encrtpted token) to the Service.my token looks like "LogCert=534635336bsdvshsg".For SOAP UI I just pass it as a cookie to header.
kiran k
Execute $proxy | Get-Member and see if there are any members related to setting the security token.
Keith Hill
I get the method but to get the response for the methods i need to pass the Security Token in the Header. So when I use New-WebServiceProxy how will I pass the the header.
kiran k
Content-Type: text/xml;charset=UTF-8cookie: LoginCert=iLmD3psnE4TfB9Ln4iyRSa10yC9Content-Length: 1812
kiran k